private void TeamRechHis_Click(object obj) { this.TeamRechHistorySearch.IsEnabled = false; Mouse.OverrideCursor = Cursors.Wait; this.IsBusy = true; try { if (obj is ArrayList) { ArrayList dataList = obj as ArrayList; this.ServiceConnectionChecker(); switch (this.Option) { case "ByDate": this.TeamRechHisGridView.ItemsSource = ServerConnection.serviceFromServer.TeamRechargeHistoryDate(dataList[3] as String, (DateTime)dataList[0]); break; case "BetweenTwoDate": this.TeamRechHisGridView.ItemsSource = ServerConnection.serviceFromServer.TeamRechargeHistoryTwoDate(dataList[3] as String, (DateTime)dataList[1], (DateTime)dataList[2]); break; case "All": this.TeamRechHisGridView.ItemsSource = ServerConnection.serviceFromServer.TeamRechargeHistoryAll(dataList[3] as String); break; default: break; } } } catch (Exception error) { Mouse.OverrideCursor = null; DXMessageBox.Show(error.Message, CVsVariables.SOTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Error); } finally { this.TeamRechHistorySearch.IsEnabled = true; Mouse.OverrideCursor = null; this.IsBusy = false; } }
public void Load() { try { using (var isolatedStorageFileStream = new IsolatedStorageFileStream(UsersFileName, FileMode.OpenOrCreate, _isolatedStorageFile)) { using (var reader = new StreamReader(isolatedStorageFileStream)) { while (true) { var line = reader.ReadLine(); if (String.IsNullOrEmpty(line)) { break; } var array = line.Split(':'); if (!_dictionary.ContainsKey(array[0])) { _dictionary.Add(array[0], array[1]); } } } } //Get Last Login UserName using (var isolatedStorageFileStream = new IsolatedStorageFileStream(LoginFileName, FileMode.OpenOrCreate, _isolatedStorageFile)) { using (var reader = new StreamReader(isolatedStorageFileStream)) { var line = reader.ReadLine(); if (String.IsNullOrEmpty(line)) { return; } var array = line.Split(':'); _currentUser = array[0]; chboxRemember.IsChecked = _isRemember = array[1].Equals("1"); } } } catch (Exception ex) { _log.Error(ex); DXMessageBox.Show("Runtime Error:" + ex.Message); } }
protected override void OnDelClick(DataRow selectedRow) { string name = selectedRow["name"].ToString(); string pkVal = selectedRow[PrimaryKey].ToString(); DXMessageBox.btnOKClick += (object sender, EventArgs e) => { bool suc = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, pkVal); if (suc) { GetData(); DXMessageBox.Show(string.Format("用户【{0}】删除成功!", name), true); } else { DXMessageBox.ShowWarning("删除失败!"); } }; DXMessageBox.ShowQuestion("确定要删除用户【" + name + "】吗?"); }
static void app_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { if (DXSplashScreen.IsActive) { DXSplashScreen.Close(); } Exception ex = e.Exception; System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (string str in ex.StackTrace.Split(new char[] { '\n' })) { if (!str.Contains("at System.")) { sb.Append(str); } } ApplicationUtils.SaveException(ex); DXMessageBox.Show(ex.Message + Environment.NewLine + sb.ToString(), "系统异常", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); e.Handled = true; }
public override bool Enter() { demo.InteractiveControlsEnabled = false; demo.btnGenerateTableData.IsEnabled = false; bool result = LoadData(); demo.btnGenerateTableData.IsEnabled = true; if (result) { demo.InteractiveControlsEnabled = true; } else { if (!IsLoad) { DXMessageBox.Show("Failed to load data. Failed to load data. Use the Generate Data Table button to check the connection parameters or generate a new sample database.", "Server Mode Demo", MessageBoxButton.OK, MessageBoxImage.Error); } } return(result); }
private void done(object obj) { if (obj != null) { BitmapSource captuteImage = (obj as BitmapSource); using (MemoryStream memStrem = new MemoryStream()) { JpegBitmapEncoder jpgeEncoder = new JpegBitmapEncoder(); jpgeEncoder.Frames.Add(BitmapFrame.Create(captuteImage)); jpgeEncoder.Save(memStrem); this._ImageInBytes = memStrem.GetBuffer(); } webCam.Stop(); this.Close(); } else { DXMessageBox.Show("Please capture image first.", CvVariables.SOFTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Error); } }
protected override void OnAddClick(EventArgs e) { if (Is_public && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveInterveneLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } UCInterveneLibEditor ucInterveneLibEditor = new UCInterveneLibEditor(); ucInterveneLibEditor.DbOperaType = DBOperateType.Add; ucInterveneLibEditor.Is_Public = Is_public; ucInterveneLibEditor.Title = "新建健康干预库"; if (ucInterveneLibEditor.ShowDialog() == DialogResult.OK) { DXMessageBox.Show("新建健康干预库成功!", true); GetData(); } ucInterveneLibEditor.Dispose(); }
private void TryLogin() { try { _isLogin = !DisableAutoLogin?Login(_currentUser, _dictionary[_currentUser]).Result : Login(cmbBoxUserName.Text, passwordBox.Password).Result; if (!_isLogin) { DXMessageBox.Show("Неверный логин или пароль!", "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error); passwordBox.Password = String.Empty; } else { Save(); Close(); } } catch (Exception ex) { _log.Error(ex); } }
private void memberRemove_Click(object obj) { Mouse.OverrideCursor = Cursors.Wait; try { if (obj is AllUserAndTeam) { (this.teamMemberList.ItemsSource as ObservableCollection <AllUserAndTeam>).Remove(obj as AllUserAndTeam); } } catch (Exception error) { Mouse.OverrideCursor = null; DXMessageBox.Show(error.Message, CVsVariables.SOTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Error); } finally { Mouse.OverrideCursor = null; } }
private void profileImagebrowseClick(object obj) { this.profileImageBrowse.IsEnabled = false; Mouse.OverrideCursor = Cursors.Wait; try { Userinformation userInfo = obj as Userinformation; userInfo.UserImage = imageOpenDialogBox(); } catch (Exception error) { Mouse.OverrideCursor = null; DXMessageBox.Show(error.Message, CVsVariables.SOTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Error); } finally { this.profileImageBrowse.IsEnabled = true; Mouse.OverrideCursor = null; } }
public static string PathMyDocument(string path) { try { string md = Environment.GetFolderPath(Environment.SpecialFolder.Personal);//путь к Документам if (Directory.Exists(md + "\\Test\\" + path) == false) { return(Directory.CreateDirectory(md + "\\Test\\" + path).FullName); } else { return(Path.Combine(md, "Test", path)); } } catch (Exception e) { DXMessageBox.Show(e.Message); throw; } }
private void btnOpenReport_Click(object sender, RoutedEventArgs e) { new DebtDAO().AutoAdd(); new DebtDAO().AutoUpdate(); DateTime date = txtDate.DateTime; using (UnileverEntities ent = new UnileverEntities()) { var lstDebt = (from c in ent.Debts where c.Year == date.Year select new { DisId = c.DistributorId, DisName = c.Distributor.Name, c.Year, Month1 = c.Month1.Value == null?0:c.Month1.Value, Month2 = c.Month2.Value == null ? 0 : c.Month2.Value, Month3 = c.Month3.Value == null ? 0 : c.Month3.Value, Month4 = c.Month4.Value == null ? 0 : c.Month4.Value, Month5 = c.Month5.Value == null ? 0 : c.Month5.Value, Month6 = c.Month6.Value == null ? 0 : c.Month6.Value, Month7 = c.Month7.Value == null ? 0 : c.Month7.Value, Month8 = c.Month8.Value == null ? 0 : c.Month8.Value, Month9 = c.Month9.Value == null ? 0 : c.Month9.Value, Month10 = c.Month10.Value == null ? 0 : c.Month10.Value, Month11 = c.Month11.Value == null ? 0 : c.Month11.Value, Month12 = c.Month12.Value == null ? 0 : c.Month12.Value }).ToList(); if (lstDebt.Count == 0) { DXMessageBox.Show("Chưa có dữ liệu thống kê"); return; } ReportDocument report = new ReportDocument(); report.Load("./Views/CrystalReport/DebtReport.rpt"); report.SetDataSource(lstDebt); crystalReportsViewer1.ViewerCore.ReportSource = report; } }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { DTO.Entity.InterestOfYear item = new DTO.Entity.InterestOfYear(); try { item.Id = int.Parse(daeYear.SelectedText); //Cho phép lãi suất bằng 0 if (string.IsNullOrEmpty(txtInterest.Text)) { item.Interest = 0; } else { item.Interest = decimal.Parse(txtInterest.Text); if (item.Interest < 0) { DXMessageBox.Show("Vui lòng nhập lãi suất dương!"); return; } else { } } if (new InterestOfYearDAO().Update(item)) { DXMessageBox.Show("Cập nhật lãi suất thành công!"); } else { DXMessageBox.Show("Cập nhật lãi suất không thành công!"); } grdIoy.ItemsSource = new InterestOfYearDAO().GetAll(); } catch (System.Exception ex) { DXMessageBox.Show("Vui lòng nhập dữ liệu!"); } }
public static bool CreateDirectoryRecursively(string path) { try { string[] pathParts = path?.Split('\\'); for (var i = 0; i < pathParts?.Length; i++) { // Correct part for drive letters if (i == 0 && pathParts[i].Contains(":")) { pathParts[i] = pathParts[i] + "\\"; } // Do not try to create last part if it has a period (is probably the file name) else if (i == pathParts.Length - 1 && pathParts[i].Contains(".")) { return(true); } if (i > 0) { pathParts[i] = Path.Combine(pathParts[i - 1], pathParts[i]); } if (!Directory.Exists(pathParts[i])) { Directory.CreateDirectory(pathParts[i]); } } return(true); } catch (Exception e) { //var recipients = _emailErrorDefaultRecipients; //var subject = "ERROR: Failed To Create Directories in " + this.ToString() + " path: " + path; //var errorMessage = Error.BuildErrorMessage(ex, subject); //Email.SendMail(recipients, subject, errorMessage); //Console.WriteLine(errorMessage); DXMessageBox.Show(e.Message); return(false); } }
private void txtInputBarCode_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { TextBox txt = sender as TextBox; if (txt != null) { if (GeneTestSetup.Instance.IsEnable) { string result = snRule.Check_Rule(txt.Text.Trim(), GeneTestSetup.Instance.SNRule); if (!string.IsNullOrEmpty(result)) { DXMessageBox.Show(result); return; } } vm.SN = txt.Text.Trim(); } Start_Click(null, null); } }
private void DealSyncResult(DialogResult dr, SyncDevice sDev = null) { if (dr == System.Windows.Forms.DialogResult.OK) { string msg = (sDev == null ? "" : "【" + sDev.deviceName + "】") + "数据同步成功!"; DXMessageBox.Show(msg, true); } else if (dr == System.Windows.Forms.DialogResult.Ignore) { DXMessageBox.Show("部分设备同步未成功!", true); } else if (dr == System.Windows.Forms.DialogResult.Cancel) { string msg = (sDev == null ? "" : "【" + sDev.deviceName + "】") + "数据同步失败!\n请尝试重新插拔设备并重试"; DXMessageBox.ShowError(msg); } else if (dr == System.Windows.Forms.DialogResult.Abort) { DXMessageBox.Show("没有可同步设备,已取消同步!", true); } }
protected override void OnEditClick(DataRow selectedRow) { if (Is_public && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveInterveneLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } UCInterveneLibEditor ucInterveneLibEditor = new UCInterveneLibEditor(); ucInterveneLibEditor.DbOperaType = DBOperateType.Update; ucInterveneLibEditor.Is_Public = Is_public; ucInterveneLibEditor.Title = "修改健康干预库"; ucInterveneLibEditor.PrimaryKeyValue = selectedRow[PrimaryKey].ToString(); if (ucInterveneLibEditor.ShowDialog() == DialogResult.OK) { DXMessageBox.Show("修改健康干预库成功!", true); GetData(); } ucInterveneLibEditor.Dispose(); }
private async void Button_Click_1(object sender, RoutedEventArgs e) { if (!updateHelper.SerialPort.IsOpen) { DXMessageBox.Show("请先配置串口"); return; } ServerRequestDeviceVersion serverRequestDeviceVersion = new ServerRequestDeviceVersion(); Log(serverRequestDeviceVersion); var version = await updateHelper.GetDeviceVersion(serverRequestDeviceVersion); if (version != null) { Log($"硬件版本:{version.HardwareVersion.Version},软件版本:{version.SoftwareVersion.Version}"); } else { Log("设备未响应,或设备未连接"); } }
/// <summary> /// 非UI线程抛出全局异常事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { var exception = e.ExceptionObject as Exception; if (exception != null) { // LogHelper.Instance.Logger.Error(exception, "非UI线程全局异常"); var userFriendlyException = exception as UserFriendlyException; if (userFriendlyException != null) { DXMessageBox.Show(userFriendlyException.Details, userFriendlyException.Message, MessageBoxButton.OK, MessageBoxImage.Error); } } } catch (Exception ex) { // LogHelper.Instance.Logger.Error(ex, "不可恢复的非UI线程全局异常"); DXMessageBox.Show("应用程序发生不可恢复的异常,将要退出!", "错误", MessageBoxButton.OK, MessageBoxImage.Error); } }
void btnRisk_Click(object sender, EventArgs e) { if (CheckedRowIndexs.Count == 0) { return; } DataRow dr = gridView1.GetDataRow(CheckedRowIndexs[0]); if (dr != null && dr["isrisk"] != null) { if (dr["isrisk"].ToString() == "已评估") { DXMessageBox.ShowWarning2("已经评估过!"); return; } else if (dr["isrisk"].ToString() == "暂存") { DXMessageBox.ShowWarning2("暂存问卷不能评估!"); return; } } else { return; } string userid = dr["user_id"].ToString(); string userTimes = dr["user_times"].ToString(); saveMedical(userid, userTimes); bool isscul = (bool)TmoServiceClient.InvokeServerMethodT <bool>(funCode.RiskNewReport, new object[] { userid, userTimes }); if (isscul) { DXMessageBox.Show("生成报告成功", true); GetData(); } else { DXMessageBox.ShowWarning2("生成报告失败!"); } }
private void SendControl() { if (socketClient != null) { List <byte> sendControl = new List <byte> { 0x7E, 0x27, 0x00, 0x46, 0x45, 0x00, 0x04 }; sendControl.Add(infoFlag); sendControl.Add(0x00); sendControl.Add(0x80); if (false) { //sendControl.Add(0x10); } else { sendControl.Add(0x1f); } int sumControl = 0; for (int i = 1; i < sendControl.Count; i++) { sumControl += sendControl[i]; } sendControl.Add(Convert.ToByte(sumControl & 0x00ff)); sendControl.Add(0x0D); BLLCommon.SendToServer(CS_AskReply.ClientControl, Properties.Settings.Default.DTUIndex, 0xff, 0xff, sendControl.ToArray()); } infoFlag++; if (infoFlag == 0xA4) { infoFlag = 0xA1; _timer.Dispose(); System.Windows.Application.Current.Dispatcher.Invoke(new Action(delegate() { BLLCommon.CloseWaitWindow(false); DXMessageBox.Show("已下发紧急操作命令!", "提示", MessageBoxButton.OK, MessageBoxImage.Information); })); } }
public bool StartConnent() { if (socketClient == null) { SocketFactory factory = new SocketFactory(); string localIp = Properties.Settings.Default.LocalIP; int localPort = Properties.Settings.Default.LocalPort; socketClient = factory.CreateSocket(ServerType.TCPClient, localIp, localPort); string log = socketClient.Run(); if (log != null) { socketClient = null; DXMessageBox.Show("连接服务器失败/n" + log, "提示", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } socketClient.SocketEventHandler += new EventHandler(SocketEventHandler); ExcuteTimerCust_Tick(this, null); ExcuteTimerCust.Start(); } return(true); }
private void OK_Click(object sender, RoutedEventArgs e) { if (comboBox_DevIndex.SelectedIndex == -1 || comboBox_DevChannel.SelectedIndex == -1) { DXMessageBox.Show((string)Application.Current.Resources["tePromptText1"], (string)FindResource("tePrompt"), MessageBoxButton.OK, MessageBoxImage.Warning); } else { IsSelected = true; _conn.DevType = m_arrdevtype[_conn.TypeIndex]; _conn.ConnObject = comboBox_DevType.SelectedItem.ToString(); _conn.RunDevice(); //保存上次打开的CAN盒类型 CANTest.Properties.Settings.Default.TypeIndex = _conn.TypeIndex; CANTest.Properties.Settings.Default.Save(); //保存设置 this.Close(); } }
private void consistenBarBtn_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) { getTableFromSelect(); if (dt.Rows.Count == 0) { DXMessageBox.Show("请选中要查询的行!"); return; } DataTable dtResult = RowConvert(dt); DocumentGroup dpGroup = DevExpress.Xpf.Core.Native.LayoutHelper.FindLayoutOrVisualParentObject(this as FrameworkElement, (el) => { return(el is DocumentGroup); }) as DocumentGroup; DocumentPanel panel = new DocumentPanel() { ShowCloseButton = true, AllowClose = true, Caption = "一致性数据" }; DetailResultData uc = new DetailResultData(dtResult); panel.Content = uc; dpGroup.Add(panel); int index = dpGroup.Items.IndexOf(panel); dpGroup.SelectedTabIndex = index; }
/// <summary> /// 출입문 추가 /// </summary> public void AddDoorCommandAction() { try { if (DoorSelected.Count == 0) { MessageBox.Show("추가할 출입문을 선택하세요"); } foreach (var door in DoorSelected) { if (!SelectedDoorCollection.Contains(door)) { SelectedDoorCollection.Add(door); } } } catch { DXMessageBox.Show("출입문 추가 실패"); } }
private byte[] imageOpenDialogBox() { System.Windows.Forms.OpenFileDialog fileOpenDialogBox = new System.Windows.Forms.OpenFileDialog(); fileOpenDialogBox.Filter = "JPEG|*.jpg|BMP|*.bmp|PNG|*.png"; fileOpenDialogBox.Title = "Select a Images"; fileOpenDialogBox.FilterIndex = 1; fileOpenDialogBox.RestoreDirectory = true; byte[] imageInbytes = null; if (fileOpenDialogBox.ShowDialog().Equals(System.Windows.Forms.DialogResult.OK)) { FileInfo ImageInfo = new FileInfo(fileOpenDialogBox.FileName); if (ImageInfo.Length < 819200) { imageInbytes = new MiraculousMethods().imageToByteArray(fileOpenDialogBox.FileName); } else { DXMessageBox.Show(CVsVariables.ERROR_MESSAGES[0, 5], CVsVariables.SOTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Stop); } } return(imageInbytes); }
/// <summary> /// UI线程抛出全局异常事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { try { var exception = e.Exception as Exception; if (exception != null) { // LogHelper.Instance.Logger.Error(e.Exception, "UI线程全局异常"); var userFriendlyException = exception as UserFriendlyException; if (userFriendlyException != null) { DXMessageBox.Show(userFriendlyException.Details, userFriendlyException.Message, MessageBoxButton.OK, MessageBoxImage.Error); } } e.Handled = true; } catch (Exception ex) { // LogHelper.Instance.Logger.Error(ex, "不可恢复的UI线程全局异常"); DXMessageBox.Show("应用程序发生不可恢复的异常,将要退出!", "错误", MessageBoxButton.OK, MessageBoxImage.Error); } }
protected override void OnDelClick(DataRow selectedRow) { string pkval = selectedRow[PrimaryKey].ToString(); string pkname = selectedRow["mt_name"].ToString(); DXMessageBox.btnOKClick += (object sender, EventArgs e) => { bool suc = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, pkval); if (suc) { DXMessageBox.Show("删除监测项目成功!", true); GetData(); } else { DXMessageBox.ShowError("删除监测项目失败,请重试!"); } }; DXMessageBox.ShowQuestion(string.Format("确定要删除监测项目【{0}】吗?", pkname)); base.OnDelClick(selectedRow); }
public void btnMAEd_Click(object sender, RoutedEventArgs e) { while (true) { if (String.IsNullOrEmpty(maBar_Copy.Text)) { DXMessageBox.Show(String.Format("لايوجد {0 } لتحديث البيانات", "رقم هاتف")); break; } if (string.IsNullOrEmpty(maName_Copy.Text)) { DXMessageBox.Show(string.Format("لايوجد {0 } لتحديث البيانات", "اسم العميل")); break; } // this.MA_ID = MA_ID; EDIT_LOA_MAX(); break; } }
private void OperateDevice_Executed(object sender, ExecutedRoutedEventArgs e) { ZLGEntity _conn = (ZLGEntity)TabGroup.SelectedItem; if (e.Parameter.ToString() == "Start") { _conn.RunDevice(); if (!_conn.Flag) { DXMessageBox.Show((string)Application.Current.Resources["tePromptText2"], (string)Application.Current.Resources["tePrompt"], MessageBoxButton.OK, MessageBoxImage.Warning); } } else if (e.Parameter.ToString() == "Close") { _conn.StopDevice(); tabSource.Remove(_conn); } else { _conn.StopDevice(); } }