private void Page_Loaded(object sender, RoutedEventArgs e) { WaitingBox.Show(() => { var file = Environment.CurrentDirectory; //读取路径 var filepatch = file + @"\" + "config.ini"; //配置文件 var ini = new IniFile(filepatch); if (bool.Parse(ini.IniReadValue("Default", "OnDownRoad_Mojang")) && !bool.Parse(ini.IniReadValue("Default", "OnDownRoad_Zhcn"))) { _strjson = GetJson.GetUrlContent("https://launchermeta.mojang.com/mc/game/version_manifest.json"); } if (!bool.Parse(ini.IniReadValue("Default", "OnDownRoad_Mojang")) && bool.Parse(ini.IniReadValue("Default", "OnDownRoad_Zhcn"))) { _strjson = GetJson.GetUrlContent("http://bmclapi2.bangbang93.com/mc/game/version_manifest.json"); } //string strjson = File.ReadAllText(@"F:\Chrome\version_manifest.json"); var verdata = JsonMapper.ToObject(_strjson); var verjson = verdata["versions"]; //var ver = verdata["versions"]["id"].ToString(); for (int i = 0; i < verjson.Count; i++) { string[] tm = verjson[i]["time"].ToString().Split('T', '+'); string tmi = tm[0] + " || " + tm[1]; //var rela = new List<string>(); if (!Directory.Exists($"{Environment.CurrentDirectory}/.minecraft/versions/{verjson[i]["id"]}/")) { if (verjson[i]["type"].ToString() == "release") { var data = new Listdata { Version = verjson[i]["id"].ToString(), Time = tmi, Name = "正式版", Url = verjson[i]["id"] + "|" + verjson[i]["url"] }; _list.Add(data); } if (verjson[i]["type"].ToString() == "snapshot") { var data = new Listdata { Version = verjson[i]["id"].ToString(), Time = tmi, Name = "快照版", Url = verjson[i]["id"] + "|" + verjson[i]["url"] }; _list1.Add(data); } if (verjson[i]["type"].ToString().IndexOf("old", StringComparison.Ordinal) > -1) { var data = new Listdata { Version = verjson[i]["id"].ToString(), Time = tmi, Name = "远古版", Url = verjson[i]["id"] + "|" + verjson[i]["url"] }; _list2.Add(data); } } } _query = from items in _list orderby items.Name descending select items; _query1 = from items in _list1 orderby items.Name descending select items; _query2 = from items in _list2 orderby items.Name descending select items; }, "正在获取官方版本信息,请稍后..."); ListView.ItemsSource = _query; ListView001.ItemsSource = _query1; ListView002.ItemsSource = _query2; _strjson = null; }
private void FButton_Click(object sender, RoutedEventArgs e) { WaitingBox.Show(() => { System.Threading.Thread.Sleep(3000); }, "正在玩命的加载,请稍后..."); var res = MessageBoxX.Question("已经完了?"); }
private void BtnWaitingBox_Click(object sender, RoutedEventArgs e) { WaitingBox.Show(() => { System.Threading.Thread.Sleep(3000); }, "正在加载,请稍后..."); MessageBoxz.ShowInfo("加载完毕!"); }
/// <summary> /// 显示等待框,callback为需要执行的方法体(需要自己做异常处理)。 /// 目前等等框为模式窗体 /// </summary> public static void Show(Action callback, string mes = "有一种幸福,叫做等待...") { WaitingBox win = new WaitingBox(callback); Window pwin = ControlHelper.GetTopWindow(); win.WindowStartupLocation = WindowStartupLocation.CenterOwner; win.Owner = pwin; win.Text = mes; win.ShowDialog(); }
private void btn_connect_Click(object sender, RoutedEventArgs e) { //启动后台线程 BackgroundWorker dataWokerThread = new BackgroundWorker(); dataWokerThread.WorkerReportsProgress = true; dataWokerThread.WorkerSupportsCancellation = true; dataWokerThread.DoWork += ConnetAP_DoWork; dataWokerThread.RunWorkerCompleted += ConnectAP_Completed; object[] ps = new object[2]; ps[0] = ap_user.Text; ps[1] = ap_password.Password; dataWokerThread.RunWorkerAsync(ps); //显示等待窗口 waitBox = new WaitingBox(); waitBox.Show(this, "正在连接,请稍后..."); }
private void StartWorker() { try { if (_waitingBox == null || _waitingBox.IsDisposed) { _waitingBox = new WaitingBox(); } _waitingBox.Show(); Application.DoEvents(); _isOpeningWaitingBox = true; } catch (Exception exc) { AppLogger.logError("[AutoSync - StartWorker]", exc.Message); } }
static public void NewBoxReadyToDown() { if (grid == null) { new Exception("缺少活动区域"); } if (waitingGrid == null) { new Exception("缺少等候区域"); } if (WaitingBox == null) { WaitingBox = BoxFactory.GetRandomBox(ref grid); } waitingGrid.Children.Clear(); if (waitingGrid == null) { ActivityBox = BoxFactory.GetRandomBox(ref grid); } else { ActivityBox = WaitingBox; } ActivityBox.OnButtom += ActivityBox_OnButtom; ActivityBox.Ready(); ActivityBox.AutoDown(); WaitingBox = BoxFactory.GetRandomBox(ref grid); waitingGrid.Children.Clear(); WaitingBox.ShowWaiting(ref waitingGrid); if (ActivityBox.IsOverlapping()) { ActivityBox.Pause(); if (OnGameOver != null) { OnGameOver(null, null); } } }
private void Page_Loaded(object sender, RoutedEventArgs e) { WaitingBox.Show(() => { string strjson = GetJson.GetUrlContent("https://launchermeta.mojang.com/mc/game/version_manifest.json"); //string strjson = File.ReadAllText(@"F:\Chrome\version_manifest.json"); JsonData verdata = JsonMapper.ToObject(strjson); JsonData verjson = verdata["versions"]; for (int i = 0; i < verjson.Count; i++) { string[] tm = verjson[i]["time"].ToString().Split(new char[2] { 'T', '+' }); string tmi = tm[0] + " || " + tm[1]; string vs; if (verjson[i]["type"].ToString() == "snapshot") { vs = "快照版"; } else if (verjson[i]["type"].ToString() == "release") { vs = "正式版"; //text.Foreground = Brushes.Green; } else if (verjson[i]["type"].ToString().IndexOf("old") > -1) { vs = "远古版"; } else { vs = verjson[i]["type"].ToString(); } var data = new listdata() { version = verjson[i]["id"].ToString(), time = tmi, Name = vs, url = verjson[i]["url"].ToString() }; list.Add(data); } query = from items in list orderby items.Name descending select items; }, "正在获取官方版本信息,请稍后..."); listView.ItemsSource = query; }
private void btn_scan_Click(object sender, RoutedEventArgs e) { //启动后台线程 BackgroundWorker dataWokerThread = new BackgroundWorker(); dataWokerThread.WorkerReportsProgress = true; dataWokerThread.WorkerSupportsCancellation = true; dataWokerThread.DoWork += ScanDev_DoWork;; dataWokerThread.RunWorkerCompleted += ScanDev_Completed; object[] ps = new object[3]; ps[0] = ip_begin_h.Text; ps[1] = ip_begin_t.Text; ps[2] = ip_end_t.Text; dataWokerThread.RunWorkerAsync(ps); //显示等待窗口 waitBox = new WaitingBox(); waitBox.Show(this, "正在扫描,请稍后..."); }
public void SaveSubScoreAccount(int Sub_score, int id) { try { using (var db = new SQLiteDB()) { WaitingBox.Show(ControlBoard.Instance, () => { var acc = db.FrontAccounts.First(a => a.IsClear == false); ObservableCollection <AddSubScoreRecord> record = new ObservableCollection <AddSubScoreRecord>(); if (acc == null) { acc = new FrontAccount() { CreateTime = DateTime.Now, IsClear = false, JsonScoreRecord = "" }; record = Desk.Instance.CreateNewScoreRecord(); acc.JsonScoreRecord = JsonConvert.SerializeObject(record); db.FrontAccounts.Add(acc); } record = JsonConvert.DeserializeObject <ObservableCollection <AddSubScoreRecord> >(acc.JsonScoreRecord); var p_record = record.First(a => Convert.ToInt32(a.PlayerId) == id); p_record.TotalSubScore += Sub_score; p_record.TotalAccount -= Sub_score; acc.JsonScoreRecord = JsonConvert.SerializeObject(record); db.SaveChanges(); }, "数据存储中..."); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); MessageBox.Show("数据库出错"); } }
/// <summary> /// 进项管理登录 /// </summary> private void JxLogin() { string token = string.Empty, ErrorMsg = string.Empty, errCode = string.Empty; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { //新版本调用大象token.dll取token 20190309 int retryCount = 3; do { --retryCount; token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); errCode = GetTokenHelper.retCode; ErrorMsg = GetTokenHelper.ErrorMsg; } while (errCode != "0000" && retryCount > 0); }, PRO_ReceiptsInvMgr.Resources.Message.loginWait); })); if (errCode != "0000") { if (ErrorMsg.Contains("0xA7")) { ErrorMsg = PRO_ReceiptsInvMgr.Resources.Message.NotFindTax; } MessageBoxEx.Show(this, ErrorMsg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } else { GlobalInfo.token = token; JXManager win = new JXManager(); win.Show(); } }
/// <summary> /// 加载固定应用 /// </summary> private void GetInnerApp() { btnList = new List <Button>(); var btnJXGLClient = new Button(); btnJXGLClient.Style = this.FindResource("MenuButton") as Style; btnJXGLClient.Tag = "进项管理"; btnJXGLClient.Cursor = Cursors.Hand; btnJXGLClient.Width = 90; btnJXGLClient.Height = 105; btnJXGLClient.Background = new ImageBrush(new BitmapImage(new Uri(PRO_ReceiptsInvMgr.Resources.Common.IcoJxglApp))); btnJXGLClient.UseLayoutRounding = true; stpanelApp.Children.Add(btnJXGLClient); btnJXGLClient.Click += new RoutedEventHandler((s, e) => { if (!GlobalInfo.ExistTax) { MessageBoxEx.Show(this, Message.NoTaxDiskTip2, Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Information); return; } if (JXManager.JXManagerInstance != null) { JXManager.JXManagerInstance.Activate(); JXManager.JXManagerInstance.WindowState = WindowState.Normal; return; } Task.Factory.StartNew(() => { var isRegister = false; string errorMsg = string.Empty; bool isOpen = false; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { isOpen = ValieIsOpen(AppCode.JXGL); if (!isOpen) { return; } isRegister = mainWindowService.IsRegister(out errorMsg); }, PRO_ReceiptsInvMgr.Resources.Message.LoadingWait); })); if (!isOpen) { return; } this.Dispatcher.BeginInvoke(new Action(() => { if (isRegister) { JxLogin(); } else { if (!string.IsNullOrEmpty(errorMsg)) { MessageBoxEx.Show(errorMsg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } else { if (jxRegister == null) { jxRegister = new JXRegister(); jxRegister.Show(); NotifyMenuItemMin_Click(null, null); jxRegister.Closing += new CancelEventHandler((ss, args) => { jxRegister = null; }); } else { jxRegister.Activate(); jxRegister.WindowState = WindowState.Normal; } } } })); }); }); btnList.Add(btnJXGLClient); var btnJXClient = new Button(); btnJXClient.Style = this.FindResource("MenuButton") as Style; btnJXClient.Tag = "发票查验"; btnJXClient.Cursor = Cursors.Hand; btnJXClient.Width = 90; btnJXClient.Height = 105; btnJXClient.Background = new ImageBrush(new BitmapImage(new Uri(PRO_ReceiptsInvMgr.Resources.Common.IcoFpcyApp))); btnJXClient.UseLayoutRounding = true; stpanelApp.Children.Add(btnJXClient); btnJXClient.Click += new RoutedEventHandler((s, e) => { if (fpcyWin == null) { bool isOpen = false; WaitingBox.Show(() => { isOpen = ValieIsOpen(AppCode.FPCY); }, PRO_ReceiptsInvMgr.Resources.Message.LoadingWait); if (!isOpen) { return; } fpcyWin = new FPCY(); fpcyWin.Show(); NotifyMenuItemMin_Click(null, null); fpcyWin.Closing += new CancelEventHandler((ss, args) => { NotifyMenuItemRestore_Click(null, null); fpcyWin = null; }); } else { fpcyWin.Activate(); fpcyWin.WindowState = WindowState.Normal; } }); btnList.Add(btnJXClient); }
private void btnGXRZ_Click(object sender, RoutedEventArgs e) { var checkedList = m_invoiceList.Where(x => x.IsChecked).ToList(); int count = checkedList.Count; if (count == 0) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.SelectGXInvoice, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Information); return; } else if (count > 60) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.OutOfFpCount, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } string confirmTip = string.Format("勾选总张数:{0} 张 总金额:{1} 元 总税额:{2} 元", count, SmrzViewModelInstance.TotalAmount, SmrzViewModelInstance.TotalSE); GxrzConfirm confirmWin = new GxrzConfirm(); confirmWin.ConfirmTip = confirmTip; confirmWin.SelectedList = checkedList; confirmWin.DoRzAction = () => { Task.Factory.StartNew(() => { string msg = string.Empty; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { service.GXRZ(checkedList, out msg); //20190409 取数据失败时,如果是token过期则重新获取并重试 if (msg.Contains("token过期")) { int retryCount = 3; do { --retryCount; GlobalInfo.token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); } while (GlobalInfo.token.Length == 0 && retryCount > 0); service.GXRZ(checkedList, out msg); } }, PRO_ReceiptsInvMgr.Resources.Message.GxrzWait); })); this.Dispatcher.BeginInvoke(new Action(() => { if (!string.IsNullOrEmpty(msg)) { MessageBoxEx.Show(JXManager.JXManagerInstance, msg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } if (msg.IndexOf("成功") != -1) { m_invoiceList.RemoveAll(x => x.IsChecked); } //显示 SmrzViewModelInstance.InvoiceList = new ObservableCollection <JXInvoiceInfo>(m_invoiceList); // SmrzViewModelInstance.YqTipCounts = SmrzViewModelInstance.InvoiceList.Count(x => x.YQTXBZ); this.Dispatcher.BeginInvoke(new Action(() => { splYqRemain.Visibility = SmrzViewModelInstance.YqTipCounts > 0 ? Visibility.Visible : Visibility.Collapsed; pcPage.TotalCount = m_invoiceList.Count; gifLoading.Visibility = Visibility.Collapsed; if (m_invoiceList.Count > 0) { pcPage.Visibility = Visibility.Visible; pcPage_DataSourcePageSize(null, null); } else { imgTip.Visibility = Visibility.Visible; } CalcTotalChecked(); })); })); }); }; confirmWin.Owner = JXManager.JXManagerInstance; confirmWin.ShowDialog(); }
private void btnQuery_Click(object sender, RoutedEventArgs e) { var btn = sender as Button; btn.IsEnabled = false; try { if (!ValidQuery()) { btn.IsEnabled = true; return; } fpcyViewModelInstance.QueryModel.taxNo = " "; string invoiceDate = fpcyViewModelInstance.QueryModel.InvoiceDate; fpcyViewModelInstance.QueryModel.InvoiceDate = DateTime.Parse(invoiceDate).ToString("yyyyMMdd"); string strRequest = new JavaScriptSerializer().Serialize(fpcyViewModelInstance.QueryModel); fpcyViewModelInstance.QueryModel.InvoiceDate = invoiceDate; string retMsg = string.Empty; var fpcyResult = FpcyResult.FailNotSave; Task.Factory.StartNew(() => { this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { fpcyResult = fpcyService.DoFPZY(strRequest, ref retMsg); }, PRO_ReceiptsInvMgr.Resources.Message.SearchWaitTip); })); if (fpcyResult == FpcyResult.FailAndSave || fpcyResult == FpcyResult.FailNotSave) { this.Dispatcher.Invoke(new Action(() => { MessageBoxEx.Show(this, retMsg, Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); })); } if (fpcyResult == FpcyResult.SuccessAndSave || fpcyResult == FpcyResult.FailAndSave) { string errorMsg = string.Empty; this.Dispatcher.Invoke(new Action(() => { list = fpcyService.GetFPCYData(ref errorMsg); this.grdList.ItemsSource = list; fpcyViewModelInstance.ListCount = list.Count; if (list.Count == 0) { imgTip.Visibility = Visibility.Visible; } else { imgTip.Visibility = Visibility.Hidden; } if (!string.IsNullOrEmpty(errorMsg)) { MessageBoxEx.Show(this, errorMsg, Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } else if (fpcyResult == FpcyResult.SuccessAndSave) { this.grdList.SelectedIndex = 0; BtnFPDetail_Click(null, null); } })); } this.Dispatcher.BeginInvoke(new Action(() => { btn.IsEnabled = true; })); }); } catch { MessageBoxEx.Show(this, PRO_ReceiptsInvMgr.Resources.Message.FpcySearchError, Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } }
public void StartWorker() { _waitingBox = new WaitingBox(); _waitingBox.Show(); Application.DoEvents(); }
private void btnLogin_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(pwd.Password)) { MessageBoxEx.Show(this, PRO_ReceiptsInvMgr.Resources.Message.PwdNotEmpty, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } var deviceId = BoxInfoHelper.GetDeviceNo(); if (string.IsNullOrEmpty(deviceId)) { MessageBoxEx.Show(this, PRO_ReceiptsInvMgr.Resources.Message.GetDeviceNoError, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } var isSuccess = false; string getDqdmError = string.Empty; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { string netLocation = service.GetNetLocation(GlobalInfo.Dqdm); if (!string.IsNullOrEmpty(netLocation)) { CryptTool.LoginUrl = netLocation + ConfigHelper.GetAppSettingValue("JXLoginUri"); CryptTool.QueryUrl = netLocation + ConfigHelper.GetAppSettingValue("JXQueryUri"); } if (!string.IsNullOrEmpty(getDqdmError)) { return; } var loop = 0; while ((loop < 5 && !string.IsNullOrEmpty(CryptTool.ErrorMsg) && CryptTool.ErrorMsg.Contains(PRO_ReceiptsInvMgr.Resources.Message.JXCertError)) || loop == 0) { isSuccess = CryptTool.Login(pwd.Password); GlobalInfo.NSRMC = CryptTool.Nsrmc; loop++; if (isSuccess) { break; } } }, PRO_ReceiptsInvMgr.Resources.Message.loginWait); })); if (!string.IsNullOrEmpty(getDqdmError)) { MessageBoxEx.Show(this, getDqdmError, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } else { Logging.Log4NetHelper.Info(this, "地区代码:" + GlobalInfo.Dqdm); } if (!isSuccess) { MessageBoxEx.Show(this, CryptTool.ErrorMsg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } else { GlobalInfo.JxPwd = pwd.Password; GlobalInfo.token = CryptTool.Token; JXManager win = new JXManager(); win.Show(); isBack = false; this.Close(); } }
private void btnGXRZ_Click(object sender, RoutedEventArgs e) { int count = invoiceList.Count(x => x.IsChecked); if (count == 0) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.SelectGXInvoice, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Information); return; } else if (count > 20) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.OutOfFpCount, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } var checkedList = invoiceList.Where(x => x.IsChecked).ToList(); var totalAmount = checkedList.Sum(x => x.HJBHSJE).Value; var totalSe = checkedList.Sum(x => x.SE).Value; YqyjViewModelInstance.TotalAmount = totalAmount.ToString("f2"); YqyjViewModelInstance.TotalSE = totalSe.ToString("f2"); string confirmTip = string.Format("勾选总张数:{0} 张 总金额:{1} 元 总税额:{2} 元", count, YqyjViewModelInstance.TotalAmount, YqyjViewModelInstance.TotalSE); GxrzConfirm confirmWin = new GxrzConfirm(); confirmWin.ConfirmTip = confirmTip; confirmWin.SelectedList = checkedList; confirmWin.DoRzAction = () => { Task.Factory.StartNew(() => { string msg = string.Empty; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { service.GXRZ(checkedList, out msg); //20190409 取数据失败时,如果是token过期则重新获取并重试 if (msg.Contains("token过期")) { int retryCount = 3; do { --retryCount; GlobalInfo.token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); } while (GlobalInfo.token.Length == 0 && retryCount > 0); service.GXRZ(checkedList, out msg); } }, PRO_ReceiptsInvMgr.Resources.Message.GxrzWait); })); this.Dispatcher.BeginInvoke(new Action(() => { if (!string.IsNullOrEmpty(msg)) { MessageBoxEx.Show(JXManager.JXManagerInstance, msg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } btnQuery_Click(null, null); })); }); }; confirmWin.Owner = JXManager.JXManagerInstance; confirmWin.ShowDialog(); }