using Common.system;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.IO;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using XHZB.Desktop.Utils;
using XHZB.Model;
namespace XHZB.Desktop
{
///
/// 登陆
///
public partial class LoginWindow : Window/*, ZJDownloadUtil.ZJDownloadCallback*/
{
#region 字段&属性
//属性定义
private Dictionary _selGroupList;
///
/// 分组下拉列表
///
public Dictionary selGroupList
{
get => _selGroupList;
set => _selGroupList = value;//NotifyOfPropertyChange("selGroupList");
}
private int _Group;
///
///当前分组
///
public int Group
{
get => _Group;
set => _Group = value;
}
///
/// 调用接口
///
private readonly RegisterController registerController = new RegisterController();
///
/// 接口返回 0成功 1失败
///
private int serverReturnCode = 0;
public DataTable data = new DataTable();
public DataTable DirectorList = new DataTable();
internal LoginPageData pageData = new LoginPageData();
///
/// 记录上次用户的选择的教材
///
private int lsbids = 0;
///
/// 记录上次用户的选择的章节
///
private int directorids = 0;
#endregion 字段&属性
#region 初始化
///
/// 初始化
///
public LoginWindow()
{
InitializeComponent();
if (!APP.CheckScreenCapturerRecorder())
{
MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
APP.InstallScreenCapturerRecorder();
}
WindowStartupLocation = WindowStartupLocation.CenterScreen;
string typestr = APP.isDebug ? "测试版" : "正式版";
bool isAdmin = IsAdministrator();
string stradmin = isAdmin ? "管理员" : "普通用户";
version_tb.Text = $"{typestr} v{FileToolsCommon.GetConfigValue("VersionName")}(Build{FileToolsCommon.GetConfigValue("VersionCode")}) [{stradmin}]";
if (File.Exists(APP.dataPath + "interfaceAddress.txt")) //若为空
{
APP.apiUrl = System.IO.File.ReadAllText(APP.dataPath + "interfaceAddress.txt", Encoding.Default);
}
if (File.Exists(APP.dataPath + "imageUploadAddress.txt")) //若为空
{
APP.uploadUrl = System.IO.File.ReadAllText(APP.dataPath + "imageUploadAddress.txt", Encoding.Default);
}
if (File.Exists(APP.dataPath + "pictureShowsAddress.txt")) //若为空
{
APP.showImageUrl = System.IO.File.ReadAllText(APP.dataPath + "pictureShowsAddress.txt", Encoding.Default);
}
if (File.Exists(APP.dataPath + "fileStorageAddress.txt")) //若为空
{
APP.fileStorageAddress = System.IO.File.ReadAllText(APP.dataPath + "fileStorageAddress.txt", Encoding.Default);
}
//APP.AESAccountStr = "9001";
//APP.AESPassWordStr = "123456";
//免登录
if (!string.IsNullOrWhiteSpace(APP.AESAccountStr) && !string.IsNullOrWhiteSpace(APP.AESPassWordStr))
{
Dispatcher.Invoke(new Action(() =>
{
txbAccountNumber.Text = APP.AESAccountStr;
pobPassword.Password = APP.AESPassWordStr;
btnLogin_Click(null, null);
}));
}
}
//#region 登陆页面验证本地激活码 1.验证成功 可登陆。 2.验证失败 弹出激活窗口。 关闭激活窗口,点击登陆时继续 弹出激活窗口
/////
///// 验证激活码
/////
//void Verification()
//{
// //如果本地文件为空,弹出弹窗 输密匙
// //本地文件不为空, 解析
// if (!File.Exists(APP.dataPath + "signature.txt"))//上次登陆时间为空 或者签名为空 或者上次登陆时间不是今天 都需要输入密匙验证 ,否则只验证本地的签名
// {
// KeyVerification wins = new KeyVerification
// {
// Topmost = true,
// Owner = this
// };
// wins.ShowDialog();
// }
// else
// {
// UnderVerification();
// }
//}
/////
///// 验证中
/////
//void UnderVerification()
//{
// MyApp.myloading.Show();
// Shared.BackgroundWorkerHelper.RunWorkerAsync(InvokeActivationDecryptServering, InvokeActivationDecryptServerCompate);
//}
/////
///// 激活信息--验证签名是否过期-调用
/////
/////
//private object InvokeActivationDecryptServering()
//{
// return Shared.ServerMsg;
//}
/////
///// 激活信息--验证签名是否过期-返回结果
/////
/////
//public void InvokeActivationDecryptServerCompate(object obj)
//{
// Dispatcher.Invoke(new Action(() =>
// {
// MyApp.myloading.Hide();
// }));
// //解析
// try
// {
// Shared.Signature = System.IO.File.ReadAllText(ZConfig.dataPath + "signature.txt", Encoding.Default);
// string decrypt = DataProvider.TripleDESDecrypt(Shared.Signature, ZConfig.secretKey);
// decrypt = decrypt.Replace("\u0001", "").Trim();
// Signatures msgBean = ZJsonHelper.JsonToObj(decrypt);
// long currentTimeTimestamp = DataProvider.TimestampTotalSeconds(); //当前时间 时间戳
// if (msgBean.endtime > currentTimeTimestamp)//条件成立 解析成功 code 在有效期内
// {
// if (File.Exists(ZConfig.dataPath + "signatureTime.txt"))
// {
// string signatureTime = System.IO.File.ReadAllText(ZConfig.dataPath + "signatureTime.txt", Encoding.Default);
// string currentTime = DateTime.Now.ToLongDateString().ToString();//当前时间
// if (signatureTime != currentTime)
// {
// Shared.BackgroundWorkerHelper.RunWorkerAsync(InvokeActivationAddHistoryServering, InvokeActivationAddHistoryServerCompate);
// }
// }
// ZConfig.isActivationSuccessful = true;
// //Dispatcher.Invoke(new Action(() =>
// //{
// // //LoginWindow win = new LoginWindow();
// // //win.Show();
// // //Close();
// //}));
// }
// else//时间失效
// {
// Dispatcher.Invoke(new Action(() =>
// {
// KeyVerification wins = new KeyVerification
// {
// Topmost = true,
// Owner = this
// };
// wins.ShowDialog();
// //Close();
// }));
// }
// }
// catch (Exception) //解析失败 输code
// {
// Dispatcher.Invoke(new Action(() =>
// {
// KeyVerification wins = new KeyVerification
// {
// Topmost = true,
// Owner = this
// };
// wins.ShowDialog();
// //Close();
// }));
// }
//}
/////
///// 激活信息--添加激活历史-调用
/////
/////
//private object InvokeActivationAddHistoryServering()
//{
// serverReturnCode = registerController.ActivationAddHistory(ref Shared.TeachingData);
// return Shared.ServerMsg;
//}
/////
///// 激活信息--添加激活历史-返回结果
/////
/////
//public void InvokeActivationAddHistoryServerCompate(object obj)
//{
// if (!Directory.Exists(APP.dataPath))
// {
// Directory.CreateDirectory(APP.dataPath);
// }
// string ApplicationData = APP.dataPath + "signatureTime.txt";
// string currentTime = DateTime.Now.ToLongDateString().ToString();//当前时间
// System.IO.File.WriteAllText(ApplicationData, currentTime, Encoding.Default);//存放签名验证日期
//}
//#endregion
public bool IsAdministrator()
{
WindowsIdentity current = WindowsIdentity.GetCurrent();
WindowsPrincipal windowsPrincipal = new WindowsPrincipal(current);
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
}
///
/// 初始化加载
///
///
///
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
btnLogin.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1D8AF4"));
//imgBrush.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/Login/login2_0.png"));
if (GetSettingString("isRemind").Equals("True"))
{
ckSaveName.IsChecked = true;
txbAccountNumber.Text = GetSettingString("userName");
}
//if (GetSettingString("OutputInforLog").Equals("1"))
//{
// ZConfig.outputInforLog = true;
//}
//Verification();
getNewApp();
}
#endregion 初始化
#region 事件
///
/// 窗体移动事件
///
///
///
private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
{
DragMove();
}
///
/// 窗口弧度
///
///
///
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{
System.Windows.Rect r = new System.Windows.Rect(e.NewSize);
RectangleGeometry gm = new RectangleGeometry(r, 1, 1);
((UIElement)sender).Clip = gm;
}
///
/// 登陆事件
///
///
///
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
//if (!ZConfig.isActivationSuccessful)
//{
// Verification();
// return;
//}
if (string.IsNullOrEmpty(txbAccountNumber.Text))
{
MessageWindow.Show("账号未输入");
return;
}
if (string.IsNullOrEmpty(pobPassword.Password))
{
MessageWindow.Show("密码未输入");
return;
}
APP.myloading.Show();
APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeServering, InvokeServerCompate);
}
///
/// 开始上课
///
///
///
private void btnClassesBegin_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrWhiteSpace(cmbClass.Text))
{
MessageWindow.Show("尚未选择班级");
return;
}
if (string.IsNullOrEmpty(cmbTeachingMaterial.Text))
{
MessageWindow.Show("尚未选择章节");
return;
}
APP.myloading.Show();
APP.classid = Convert.ToInt32(cmbClass.SelectedValue.ToString());
for (int i = 0; i < APP.ClassList.Count; i++)
{
if (APP.classid == APP.ClassList[i].classid)
{
APP.REQStartClass.classnum = APP.ClassList[i].classnum;
}
}
APP.REQStartClass.roomname = DateTime.Now.ToString() + cmbClass.Text;
APP.REQStartClass.directorid = Convert.ToInt32(cmbTeachingMaterial.SelectedValue.ToString());
APP.REQStartClass.roomid = TimestampAddRandomNumber();
APP.roomid = APP.REQStartClass.roomid;
try
{
//记录教材 章节 及当前登陆用户id
string ApplicationData = APP.dataPath + "loginUserid.txt";
string temp = APP.LoginUser.userid.ToString();
System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
ApplicationData = APP.dataPath + "loginLsbid.txt";
temp = APP.lsbid.ToString();
System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
ApplicationData = APP.dataPath + "loginDirectorid.txt";
temp = APP.REQStartClass.directorid.ToString();
System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
}
catch (Exception ex)
{
LogHelper.WriteErrLog("【登陆(LoginWindow)" + ex.Message, ex);
}
APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeClassStudentListServering, InvokeServerClassStudentListCompate);
}
///
/// 返回一个时间戳加3位随机数的long型整数
///
///
public long TimestampAddRandomNumber()
{
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
string timestr = Convert.ToInt64(ts.TotalMilliseconds).ToString();
long tick = DateTime.Now.Ticks;
Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
int random = ran.Next(100, 999);
return Convert.ToInt64(timestr + random.ToString());
}
///
/// 关闭
///
///
///
private void btnDown_Click(object sender, RoutedEventArgs e)
{
Close();
Application.Current.Shutdown();
System.Environment.Exit(0);
}
#endregion 事件
#region 方法
///
/// 读取客户设置
///
///
///
public static string GetSettingString(string settingName)
{
try
{
string settingString = FileToolsCommon.GetConfigValue(settingName);
return settingString;
}
catch (Exception)
{
return null;
}
}
///
/// 更新设置
///
///
///
public static void UpdateSettingString(string settingName, string valueName)
{
//Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
//if (ConfigurationManager.AppSettings[settingName] != null)
//{
// config.AppSettings.Settings.Remove(settingName);
//}
//config.AppSettings.Settings.Add(settingName, valueName);
//config.Save(ConfigurationSaveMode.Modified);
//ConfigurationManager.RefreshSection("appSettings");
}
///
/// 检测APP更新
///
private void getNewApp()
{
//new Thread(o =>
//{
// string url = ZConfig.apiUrl + "/appclient/get_new";
// string result = ZHttpUtil.PostAndRespStr(url, "{}");
// Model.ResultVo resultObj = ZJsonHelper.JsonToObj>(result);
// if (result != null && resultObj.code == 0)
// {
// if (resultObj.obj != null)
// {
// int versionCode = resultObj.obj.versioncode;
// int versionThis = ZConfig.versionCode;
// if (versionThis < versionCode)
// {
// Dispatcher.Invoke(new Action(() =>
// {
// appUpdateShow(resultObj.obj);
// }));
// }
// }
// }
//}).Start();
}
/////
///// 应用更新
/////
/////
//private void appUpdateShow(AppModel app)
//{
// AppUpdateWin win = new AppUpdateWin(app);
// win.Topmost = true;
// win.Owner = this;
// win.ShowDialog();
//}
///
/// 登陆服务-调用
///
///
private object InvokeServering()
{
string accountNumber = string.Empty;
string password = string.Empty;
Dispatcher.Invoke(new Action(() =>
{
accountNumber = txbAccountNumber.Text.Replace(" ", "").Trim();
password = pobPassword.Password.Replace(" ", "").Trim();
}));
serverReturnCode = registerController.Login(accountNumber, password);
return APP.ErrorMessage;
}
///
/// 登陆服务-返回结果
///
///
public void InvokeServerCompate(object obj)
{
APP.myloading.Hide();
if (serverReturnCode == APP.ServerScuessCode)
{
new Thread(o =>
{
InvokeLiveBroadcastServering();
Dispatcher.Invoke(new Action(() =>
{
InvokeServerLiveBroadcastCompate();
}));
}).Start();
//grLogin.Visibility = Visibility.Collapsed;
//grLoginTwo.Visibility = Visibility.Visible;
//imgBrush.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/Login/login2_1.png"));
//txbHeader.Text = APP.LoginUser.username + "老师,您好!";
//version_tb.Visibility = Visibility.Collapsed;
//btnSetUp.Visibility = Visibility.Collapsed;
//UpdateSettingString("userName", txbAccountNumber.Text);
//new Thread(o =>
//{
// InvokeClassListServering();
// Dispatcher.Invoke(new Action(() =>
// {
// InvokeServerClassListCompate();
// }));
//}).Start();
//new Thread(o =>
//{
// InvokeTsubjectbookListServering();
// Dispatcher.Invoke(new Action(() =>
// {
// InvokeServerTsubjectbookListCompate();
// }));
//}).Start();
}
else
{
MessageWindow.Show(APP.ErrorMessage);
}
}
///
/// 开始直播服务-调用
///
///
private object InvokeLiveBroadcastServering()
{
serverReturnCode = registerController.ClassList();
return APP.ErrorMessage;
}
///
/// 开始直播服务-返回结果
///
///
public void InvokeServerLiveBroadcastCompate()
{
if (serverReturnCode == APP.ServerScuessCode)
{
string imagepath = APP.classRoomImagePath();
if (!Directory.Exists(imagepath))
{
Directory.CreateDirectory(imagepath);
}
ToolbarWindow win = new ToolbarWindow();
Close();
win.ShowDialog();
}
else
{
MessageWindow.Show(APP.ErrorMessage);
}
}
///
/// 教师任教班级服务-调用
///
///
private object InvokeClassListServering()
{
serverReturnCode = registerController.ClassList();
return APP.ErrorMessage;
}
///
/// 教师任教班级服务-返回结果
///
///
public void InvokeServerClassListCompate()
{
if (serverReturnCode == APP.ServerScuessCode)
{
data.Columns.Add("Value");
data.Columns.Add("Key");
for (int i = 0; i < APP.ClassList.Count; i++)
{
//创建一行
DataRow row = data.NewRow();
//将此行添加到table中
data.Rows.Add(row);
if (APP.ClassList[i].gradeid != null)
{
switch (APP.ClassList[i].gradeid)
{
case 1:
data.Rows[i]["Value"] = "一年级" + APP.ClassList[i].classname;
break;
case 2:
data.Rows[i]["Value"] = "二年级" + APP.ClassList[i].classname;
break;
case 3:
data.Rows[i]["Value"] = "三年级" + APP.ClassList[i].classname;
break;
case 4:
data.Rows[i]["Value"] = "四年级" + APP.ClassList[i].classname;
break;
case 5:
data.Rows[i]["Value"] = "五年级" + APP.ClassList[i].classname;
break;
case 6:
data.Rows[i]["Value"] = "六年级" + APP.ClassList[i].classname;
break;
case 7:
data.Rows[i]["Value"] = "七年级" + APP.ClassList[i].classname;
break;
case 8:
data.Rows[i]["Value"] = "八年级" + APP.ClassList[i].classname;
break;
case 9:
data.Rows[i]["Value"] = "九年级" + APP.ClassList[i].classname;
break;
case 10:
data.Rows[i]["Value"] = "高一" + APP.ClassList[i].classname;
break;
case 11:
data.Rows[i]["Value"] = "高二" + APP.ClassList[i].classname;
break;
case 12:
data.Rows[i]["Value"] = "高三" + APP.ClassList[i].classname;
break;
default:
data.Rows[i]["Value"] = APP.ClassList[i].classname;
break;
}
}
else
{
data.Rows[i]["Value"] = APP.ClassList[i].classname;
}
data.Rows[i]["Key"] = APP.ClassList[i].classid;
}
dtComponentsUniqueNo = data.DefaultView.ToTable();
cmbClass.ItemsSource = dtComponentsUniqueNo.DefaultView;
cmbClass.SelectedIndex = 0;
//Shared.BackgroundWorkerHelper.RunWorkerAsync(InvokeTsubjectbookListServering, InvokeServerTsubjectbookListCompate);
}
else
{
MessageWindow.Show(APP.ErrorMessage);
}
}
///
/// 教师教材列表服务-调用
///
///
private object InvokeTsubjectbookListServering()
{
serverReturnCode = registerController.TsubjectbookList();
return APP.ErrorMessage;
}
///
/// 教师教材列表服务-返回结果
///
///
public void InvokeServerTsubjectbookListCompate()
{
if (serverReturnCode == APP.ServerScuessCode)
{
try
{
if (File.Exists(APP.dataPath + "loginUserid.txt"))
{
string userid = System.IO.File.ReadAllText(APP.dataPath + "loginUserid.txt", Encoding.Default);
if (userid.Equals(APP.LoginUser.userid.ToString()))
{
if (File.Exists(APP.dataPath + "loginLsbid.txt"))
{
string lsbid = System.IO.File.ReadAllText(APP.dataPath + "loginLsbid.txt", Encoding.Default);
lsbids = Convert.ToInt32(lsbid);
if (File.Exists(APP.dataPath + "loginDirectorid.txt"))
{
string directorid = System.IO.File.ReadAllText(APP.dataPath + "loginDirectorid.txt", Encoding.Default);
directorids = Convert.ToInt32(directorid);
}
}
}
}
}
catch (Exception ex)
{
LogHelper.WriteErrLog("【登陆(LoginWindow)" + ex.Message, ex);
}
int iTemp = 0;
for (int i = 0; i < APP.TsubjectbookList.Count; i++)
{
if (lsbids != 0 && lsbids == APP.TsubjectbookList[i].lsbid)
{
iTemp = i;
}
pageData.bookList.Add(new ComboBoxBeanModel()
{
Key = APP.TsubjectbookList[i].lsbid,
Value = $"{APP.TsubjectbookList[i].subjectname} {APP.TsubjectbookList[i].bookname}"
});
}
book_list.SelectedIndex = iTemp;
DataContext = pageData;
}
else
{
MessageWindow.Show(APP.ErrorMessage);
}
}
///
/// 章节列表服务-调用
///
///
private string InvokeDirectorListServering(int index)
{
int selectIndex = index;
if (selectIndex != -1)
{
APP.lsbid = APP.TsubjectbookList[selectIndex].lsbid;
APP.REQStartClass.subjectid = APP.TsubjectbookList[selectIndex].subjectid;
APP.REQStartClass.subjectname = APP.TsubjectbookList[selectIndex].subjectname;
APP.DirectorList = null;
serverReturnCode = registerController.DirectorList(APP.TsubjectbookList[selectIndex].lsbid,2,APP.LoginUser.userid);
}
return APP.ErrorMessage;
}
///
/// 章节列表服务-返回结果
///
///
public void InvokeServerDirectorListCompate()
{
if (serverReturnCode == APP.ServerScuessCode)
{
pageData.zhangjieList.Clear();
for (int i = 0; i < APP.DirectorList.Count; i++)
{
DirectorListModel item = APP.DirectorList[i];
pageData.zhangjieList.Add(new ComboBoxBeanModel()
{
Key = item.directorid,
Value = item.directorname
});
addChild(item);
}
cmbTeachingMaterial.SelectedIndex = 0;
for (int i = 0; i < pageData.zhangjieList.Count; i++)
{
if (pageData.zhangjieList[i].Key == directorids)
{
cmbTeachingMaterial.SelectedIndex = i;
}
}
}
else
{
MessageWindow.Show(APP.ErrorMessage);
}
}
///
/// 子章节递归
///
///
private void addChild(DirectorListModel directorList)
{
if (directorList.children != null && directorList.children.Count > 0)
{
foreach (DirectorListModel child in directorList.children)
{
pageData.zhangjieList.Add(new ComboBoxBeanModel()
{
Key = child.directorid,
Value = getSpace(child.directorlevel) + child.directorname
});
if (child.children != null && child.children.Count > 0)
{
addChild(child);
}
}
}
}
///
/// 章节是否加空格符
///
///
///
private string getSpace(int num)
{
string str = "";
for (int i = 0; i < num; i++)
{
str += " ";
}
return str;
}
///
/// 开始课堂服务-调用
///
///
private object InvokeStartClassServering()
{
//Startclass startclass = new Startclass
//{
// classid = ZCommonData.classid,
// roomname = Shared.TeachingData.REQ_StartClass.roomname,
// subjectid = Shared.TeachingData.REQ_StartClass.subjectid,
// teacherid = ZCommonData.loginUser.userid,
// directorid = Shared.TeachingData.REQ_StartClass.directorid,
// directortype = 1,
// schoolid = ZCommonData.loginUser.schoolid,
// roomid = Shared.TeachingData.REQ_StartClass.roomid,
// lsbid = ZCommonData.lsbid,
// createtime = DataProvider.TimestampTotalSeconds()
//};
//ZSqliteManger.insertClassData(new ClassData()
//{
// unix = DataProvider.TimestampTotalSeconds(),
// roomid = ZCommonData.roomid,
// api = "startclass",
// json = ZJsonHelper.ToJson(startclass),
// askid = DataProvider.TimestampAddRandomNumber()
//});
return APP.ErrorMessage;
}
///
/// 开始课堂服务-返回结果
///
///
public void InvokeStartClassCompate(object obj)
{
try
{
APP.myloading.Hide();
string imagepath = APP.classRoomImagePath();
if (!Directory.Exists(imagepath))
{
Directory.CreateDirectory(imagepath);
}
//Shared.BackgroundWorkerHelper.RunWorkerAsync(InvokeClassStudentListServering, InvokeServerClassStudentListCompate);
ToolbarWindow win = new ToolbarWindow();
Close();
win.ShowDialog();
}
catch (Exception ex)
{
LogHelper.WriteErrLog("【LoginWindow】(InvokeStartClassCompate)" + ex.Message, ex);
}
}
///
/// 班级学生--列表服务-调用
///
///
private object InvokeClassStudentListServering()
{
//serverReturnCode = registerController.ClassStudentList();
return APP.ErrorMessage;
}
///
/// 班级学生--列表服务服务-返回结果
///
///
public void InvokeServerClassStudentListCompate(object obj)
{
//MyApp.myloading.Hide();
if (serverReturnCode == APP.ServerScuessCode)
{
APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeStartClassServering, InvokeStartClassCompate);
}
else
{
APP.myloading.Hide();
MessageWindow.Show(APP.ErrorMessage);
}
}
#endregion 方法
private DataTable dtComponentsUniqueNo;
public DataTable DtComponentsUniqueNo
{
get => dtComponentsUniqueNo;
set => dtComponentsUniqueNo = value;
}
private void txbAccountNumber_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
txbAccountNumber.Text = "";
txbAccountNumber.Tag = "";
}
///
/// 单选框事件
///
///
///
private void ckSaveName_Click(object sender, RoutedEventArgs e)
{
if (ckSaveName.IsChecked == false)
{
UpdateSettingString("isRemind", ckSaveName.IsChecked.ToString());
}
else
{
UpdateSettingString("isRemind", ckSaveName.IsChecked.ToString());
}
}
public void downloadBegin(int position)
{
}
public void downloadProgress(int position, int progress)
{
}
public void downloadEnd(int position, string filepath)
{
Console.WriteLine("下载完成" + filepath + " position:" + position);
}
///
/// 教材选中事件
///
///
///
private void toolbar_list_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
int SelectedIndex = book_list.SelectedIndex;
new Thread(o =>
{
InvokeDirectorListServering(SelectedIndex);
Dispatcher.Invoke(new Action(() =>
{
InvokeServerDirectorListCompate();
}));
}).Start();
}
///
/// 设置
///
///
///
private void btnSetUp_Click(object sender, RoutedEventArgs e)
{
//SetWindow win = new SetWindow
//{
// Topmost = true
//};
//win.Show();
}
public void downloadError(int position, string msg)
{
MessageWindow.Show(msg);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
double pwidth = SystemParameters.PrimaryScreenWidth;
if (APP.W_CameraWindow == null)
{
APP.W_CameraWindow = new CameraWindow();
APP.W_CameraWindow.Topmost = true;
APP.W_CameraWindow.Left = pwidth - 320;
APP.W_CameraWindow.Top = 0;
}
APP.W_CameraWindow.Show();
}
}
public class LoginPageData : NotifyModel
{
public ObservableCollection bookList { get; set; }
public ObservableCollection zhangjieList { get; set; }
public LoginPageData()
{
bookList = new ObservableCollection();
zhangjieList = new ObservableCollection();
}
}
}