public BillingViewModel( IProductRepository productRepository, ICustomerRepository customerRepository, IOrderRepository orderRepository) { this.productRepository = productRepository; this.customerRepository = customerRepository; this.orderRepository = orderRepository; this.TextChangedCommand = new DelegateCommand <AutoSuggestBoxTextChangedEventArgs>(HandleTextChangedEvent); this.CustomerTextChangedCommand = new DelegateCommand <AutoSuggestBoxTextChangedEventArgs>(HandleCustomerTextChangedEvent); this.QuerySubmittedCommand = new DelegateCommand <AutoSuggestBoxQuerySubmittedEventArgs>(HandleQuerySubmittedEvent); this.CustomerQuerySubmittedCommand = new DelegateCommand <AutoSuggestBoxQuerySubmittedEventArgs>(HandleCustomerQuerySubmittedEvent); this.CellEditEndedCommand = new DelegateCommand <DataGridCellEditEndingEventArgs>(HandleCellEditEnded); this.SelectedDatesChangedCommand = new DelegateCommand <CalendarViewSelectedDatesChangedEventArgs>(HandleSelectedDatesChanged); this.ProceedBillingCommand = new DelegateCommand(HandleProceedEvent); this.AddCustomerCommand = new DelegateCommand(HandleAddCustomerEvent); this.ResetCommand = new DelegateCommand(ResetOrderView); this.orderItems = new ObservableCollection <OrderItemListView>(); this.orderItems.CollectionChanged += OrderItems_CollectionChanged; this.decimalTextBox = new TextBox { Height = (double)App.Current.Resources["TextControlThemeMinHeight"], Text = "1" }; TextBoxRegex.SetValidationMode(decimalTextBox, TextBoxRegex.ValidationMode.Dynamic); TextBoxRegex.SetValidationType(decimalTextBox, TextBoxRegex.ValidationType.Decimal); this.defaultTextBox = new TextBox(); TextBoxRegex.SetValidationMode(defaultTextBox, TextBoxRegex.ValidationMode.Dynamic); TextBoxRegex.SetValidationType(defaultTextBox, TextBoxRegex.ValidationType.Characters); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { TextBoxRegex.SetValidationMode(TextBoxValidated, ValidationMode); TextBoxRegex.SetValidationType(TextBoxValidated, ValidationType); TextBoxRegex.SetRegex(TextBoxValidated, Regex); TextBoxValidated.TextChanged += TextBoxValidated_TextChanged; }
private bool IsFormValid() { DisplayName_TextBox_LostFocus(null, null); URI_ComboBox_LostFocus(null, null); return(TextBoxRegex.GetIsValid(DisplayName_TextBox) && TileSize_ComboBox.Text != ""); }
private bool IsFormValid() { DisplayName_TextBox_LostFocus(null, null); CustomUri_TextBox_LostFocus(null, null); return(TextBoxRegex.GetIsValid(DisplayName_TextBox) && TextBoxRegex.GetIsValid(CustomUri_TextBox)); }
private void Initialize() { this.InitializeComponent(); this.fpdm = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("rtxtFpdm"); this.qshm = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("rtxtQshm"); this.fpzs = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("rtxtFpzs"); this.fplx = this.xmlComponentLoader1.GetControlByName <AisinoCMB>("cmbFplx"); this.labelTypeCode = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("labelTypeCode"); this.labelHeadCode = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("labelHeadCode"); this.lbl_Fpdm = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblFpdm"); this.lbl_Qshm = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblQshm"); this.lbl_Fpzs = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblFpzs"); this.btn_download = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("but_xz"); this.btn_close = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("but_close"); this.fplx.SelectedValueChanged += new EventHandler(this.fplx_SelectedValueChanged); this.fpdm.KeyPress += new KeyPressEventHandler(this.fpdm_KeyPress); this.qshm.KeyPress += new KeyPressEventHandler(this.qshm_KeyPress); this.fpzs.KeyPress += new KeyPressEventHandler(this.fpzs_KeyPress); this.fpdm.TextChanged += new EventHandler(this.fpdm_TextChanged); this.qshm.TextChanged += new EventHandler(this.qshm_TextChanged); this.fpzs.TextChanged += new EventHandler(this.fpzs_TextChanged); this.btn_download.Click += new EventHandler(this.btn_download_Click); this.btn_close.Click += new EventHandler(this.btn_close_Click); this.fpdm.set_RegexText("^[0-9]{0,12}$"); this.qshm.set_RegexText("^[0-9]{0,8}$"); this.fpzs.set_RegexText("^[0-9]{0,8}$"); }
private void Initialize() { this.InitializeComponent(); base.MaximizeBox = false; base.MinimizeBox = false; base.FormBorderStyle = FormBorderStyle.FixedDialog; this.txtNewPwd = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("txtNewPwd"); this.txtOldPwd = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("txtOldPwd"); this.btnOK = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnOK"); this.btnCancel = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnCancel"); this.groupBox1 = this.xmlComponentLoader1.GetControlByName <AisinoGRP>("groupBox1"); this.label2 = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label2"); this.label1 = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label1"); this.panel1 = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("panel1"); this.panel2 = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("panel2"); this.txtReNewPwd = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("txtReNewPwd"); this.label3 = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label3"); this.pictureBox1 = this.xmlComponentLoader1.GetControlByName <AisinoPIC>("pictureBox1"); this.txtOldPwd.set_RegexText("^[A-Za-z0-9]*$"); this.txtNewPwd.set_RegexText("^[A-Za-z0-9]*$"); this.txtReNewPwd.set_RegexText("^[A-Za-z0-9]{0,8}$"); this.txtOldPwd.MaxLength = 8; this.txtNewPwd.MaxLength = 8; this.txtOldPwd.set_IsEmpty(false); this.txtNewPwd.set_IsEmpty(false); this.txtReNewPwd.set_IsEmpty(false); this.txtOldPwd.PasswordChar = '*'; this.txtNewPwd.PasswordChar = '*'; this.txtReNewPwd.PasswordChar = '*'; this.btnOK.Enabled = false; this.txtReNewPwd.TextChanged += new EventHandler(this.txtReNewPwd_TextChanged); this.txtNewPwd.TextChanged += new EventHandler(this.txtNewPwd_TextChanged); this.btnOK.Click += new EventHandler(this.btnOK_Click); this.btnCancel.Click += new EventHandler(this.btnCancel_Click); }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { // make sure quantity is in correct format if (TextBoxRegex.GetIsValid(TextBoxQuantity) == false) { FlyoutWarmingText.Text = "Wrong numerical value!"; FlyoutWarming.ShowAt(TextBoxQuantity); args.Cancel = true; return; } if (TextBoxRegex.GetIsValid(TextBoxCost) == false) { FlyoutWarmingText.Text = "Wrong numerical value!"; FlyoutWarming.ShowAt(TextBoxCost); args.Cancel = true; return; } // perform real update TextBoxQuantity.GetBindingExpression(TextBox.TextProperty).UpdateSource(); TextBoxCost.GetBindingExpression(TextBox.TextProperty).UpdateSource(); DatePickerPurchaseDate.GetBindingExpression(DatePicker.DateProperty).UpdateSource(); ComboBoxProvider.GetBindingExpression(ComboBox.SelectedValueProperty).UpdateSource(); }
private void Initialize() { this.InitializeComponent(); this.DraweeRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_BuyerSQ"); this.CarrierRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_SellerSQ"); this.YDKRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_BuyerSQ_Ydk"); this.WDKRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_BuyerSQ_Wdk"); this.Carrier_MistakeRejectRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_SellerSQ_1"); this.Carrier_MistakeNonDeliverRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_SellerSQ_2"); this.RenZRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_BuyerSQ_Wdk_1"); this.TaxcodeRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_BuyerSQ_Wdk_2"); this.InvCodeNoRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_BuyerSQ_Wdk_3"); this.GoodsRB = this.xmlComponentLoader1.GetControlByName <AisinoRDO>("Radio_BuyerSQ_Wdk_4"); this.RenZRB.Enabled = false; this.TaxcodeRB.Enabled = false; this.InvCodeNoRB.Enabled = false; this.GoodsRB.Enabled = false; this.Carrier_MistakeRejectRB.Enabled = false; this.Carrier_MistakeNonDeliverRB.Enabled = false; this.DraweeRB.Click += new EventHandler(this.DraweeRB_Click); this.CarrierRB.Click += new EventHandler(this.CarrierRB_Click); this.YDKRB.Click += new EventHandler(this.YDKRB_Click); this.WDKRB.Click += new EventHandler(this.WDKRB_Click); this.Carrier_MistakeRejectRB.Click += new EventHandler(this.Carrier_MistakeRB_Click); this.Carrier_MistakeNonDeliverRB.Click += new EventHandler(this.Carrier_MistakeRB_Click); this.RenZRB.Click += new EventHandler(this.WDK_SubItem_Click); this.TaxcodeRB.Click += new EventHandler(this.WDK_SubItem_Click); this.InvCodeNoRB.Click += new EventHandler(this.WDK_SubItem_Click); this.GoodsRB.Click += new EventHandler(this.WDK_SubItem_Click); this.InvKindCombo = this.xmlComponentLoader1.GetControlByName <AisinoCMB>("txt_fpzl"); this.BtnNext = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("but_next"); this.BtnOK = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("but_ok"); this.BtnClose = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("but_close"); this.InvNumEdit = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("txt_fphm"); this.InvCodeEdit = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("txt_fpdm"); this.InvCodeEdit.KeyPress += new KeyPressEventHandler(this.InvCodeEdit_KeyPress); this.InvCodeEdit.MaxLength = 10; this.InvNumEdit.KeyPress += new KeyPressEventHandler(this.InvNumEdit_KeyPress); this.InvNumEdit.MaxLength = 8; this.DraweePanel = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("panel1"); this.CarrierPanel = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("panel2"); this.WDKPanel = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("panel1_2"); this.panel3 = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("panel3"); this.panel4 = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("panel4"); this.lblInfo = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblInfo"); this.csdgBlueInvInfo = this.xmlComponentLoader1.GetControlByName <CustomStyleDataGrid>("customStyleDataGrid1"); this.GridShowHeaderInit(); this.BtnClose.Click += new EventHandler(this.btn_Close_Click); this.BtnNext.Click += new EventHandler(this.btn_Next_Click); this.BtnOK.Click += new EventHandler(this.btn_Ok_Click); this.InvCodeEdit.TextChanged += new EventHandler(this.txt_fphm_TextChanged); this.InvNumEdit.TextChanged += new EventHandler(this.txt_fphm_TextChanged); this.panel5 = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("panel5"); base.Paint += new PaintEventHandler(this.HySqdInfoSelect_Paint); base.Resize += new EventHandler(this.HySqdInfoSelect_Resize); this.panel5.BorderStyle = BorderStyle.Fixed3D; }
private void DisplayName_TextBox_LostFocus(object sender, RoutedEventArgs e) { if (!TextBoxRegex.GetIsValid(DisplayName_TextBox)) { DisplayName_TextBox.BorderBrush = new SolidColorBrush(Colors.Red); } else { DisplayName_TextBox.ClearValue(BorderBrushProperty); } }
private void Initialize() { this.InitializeComponent(); this.tbxMachine = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("tbxMachine"); this.cmb_fpzl = this.xmlComponentLoader1.GetControlByName <AisinoCMB>("cmb_fpzl"); this.cmb_fpzt = this.xmlComponentLoader1.GetControlByName <AisinoCMB>("cmb_fpzt"); this.date_ksrq = this.xmlComponentLoader1.GetControlByName <DateTimePicker>("date_ksrq"); this.date_jsrq = this.xmlComponentLoader1.GetControlByName <DateTimePicker>("date_jsrq"); this.btnOK = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnOK"); this.btnCancel = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnCancel"); this.tbxMachine.KeyPress += new KeyPressEventHandler(this.tbxMachine_KeyPress); this.btnOK.Click += new EventHandler(this.btnOK_Click); this.btnCancel.Click += new EventHandler(this.btnCancel_Click); }
private void TextBoxValidated_TextChanged(object sender, TextChangedEventArgs e) { if (TextBoxRegex.GetIsValid(TextBoxValidated)) { IsValid = true; } else { IsValid = false; } if (_showValidation) { IsNotValidState = !IsValid; } }
private void Initialize() { this.InitializeComponent(); base.MaximizeBox = false; base.MinimizeBox = false; this.lblQshm = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblQshm"); this.lblZjhm = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblZjhm"); this.lblFpqshm = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblFpqshm"); this.tbxCount = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("tbxCount"); this.btnAllot = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnAllot"); this.btnFq = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnFq"); this.btnAllot.Click += new EventHandler(this.btnAllot_Click); this.btnFq.Click += new EventHandler(this.btnFq_Click); this.tbxCount.KeyPress += new KeyPressEventHandler(this.tbxCount_KeyPress); }
private void Initialize() { this.InitializeComponent(); this.txt_fphm = this.xmlComponentLoader1.GetControlByName <NoPasteText>("txt_fphm"); this.txt_fpdm = this.xmlComponentLoader1.GetControlByName <NoPasteText>("txt_fpdm"); this.but_qx = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("but_qx"); this.but_xyb = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("but_xyb"); this.but_syb = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("but_syb"); this.txt_tzdh_1 = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("txt_tzdh_1"); this.txt_tzdh = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("txt_tzdh"); this.lbl_title = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label7"); this.lblXxbTip = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label6"); this.txt_bz = this.xmlComponentLoader1.GetControlByName <AisinoTXT>("txt_bz"); this.tabControl1 = this.xmlComponentLoader1.GetControlByName <AisinoTAB>("tabControl1"); this.tabPage1 = this.xmlComponentLoader1.GetControlByName <TabPage>("tabPage1"); this.tabPage2 = this.xmlComponentLoader1.GetControlByName <TabPage>("tabPage2"); this.tabPage3 = this.xmlComponentLoader1.GetControlByName <TabPage>("tabPage3"); this.picBox1 = this.xmlComponentLoader1.GetControlByName <PictureBox>("picBox1"); this.picBox2 = this.xmlComponentLoader1.GetControlByName <PictureBox>("picBox2"); this.picBox3 = this.xmlComponentLoader1.GetControlByName <PictureBox>("picBox3"); this.label8 = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label8"); this.label9 = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label9"); this.label10 = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label10"); this.btnDetail = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnDetail"); this.txt_bz.ScrollBars = ScrollBars.Vertical; this.but_qx.Click += new EventHandler(this.but_qx_Click); this.but_xyb.Click += new EventHandler(this.but_xyb_Click); this.but_syb.Click += new EventHandler(this.but_syb_Click); this.btnDetail.Click += new EventHandler(this.btnDetail_Click); this.txt_tzdh.KeyPress += new KeyPressEventHandler(this.txt_tzdh_KeyPress); this.txt_tzdh_1.KeyPress += new KeyPressEventHandler(this.txt_tzdh_KeyPress); this.txt_tzdh.TextChanged += new EventHandler(this.txt_tzdh_TextChanged); this.txt_fpdm.KeyPress += new KeyPressEventHandler(this.txt_tzdh_KeyPress); this.txt_fphm.KeyPress += new KeyPressEventHandler(this.txt_tzdh_KeyPress); this.txt_fpdm.KeyDown += new KeyEventHandler(this.txt_KeyDown); this.txt_fphm.KeyDown += new KeyEventHandler(this.txt_KeyDown); this.txt_fpdm.ImeMode = ImeMode.Disable; this.txt_fphm.ImeMode = ImeMode.Disable; this.picBox1.BackgroundImage = Resources.ZH1; this.picBox1.BackgroundImageLayout = ImageLayout.Stretch; this.picBox2.BackgroundImage = Resources.ZH2; this.picBox2.BackgroundImageLayout = ImageLayout.Stretch; this.picBox3.BackgroundImage = Resources.ZH3; this.picBox3.BackgroundImageLayout = ImageLayout.Stretch; }
private void Initialize() { this.InitializeComponent(); base.MaximizeBox = false; base.MinimizeBox = false; this.lblInvTypeInfo = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblInvTypeInfo"); this.lblStartNumInfo = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblStartNumInfo"); this.lblEndNumInfo = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblEndNumInfo"); this.lblStartNumAlloc = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblStartNumAlloc"); this.tbxAmountAlloc = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("tbxAmountAlloc"); this.tbxMachineAlloc = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("tbxMachineAlloc"); this.btnAllocate = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnAllocate"); this.btnCancel = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnCancel"); this.tbxAmountAlloc.KeyPress += new KeyPressEventHandler(this.tbxAmountAlloc_KeyPress); this.tbxMachineAlloc.KeyPress += new KeyPressEventHandler(this.tbxMachineAlloc_KeyPress); this.btnAllocate.Click += new EventHandler(this.btnAllocate_Click); this.btnCancel.Click += new EventHandler(this.btnCancel_Click); }
// event handlers private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { // make sure name and unit are not empty string if (string.IsNullOrWhiteSpace(TextBoxName.Text)) { FlyoutWarmingText.Text = "Name cannot be empty!"; FlyoutWarming.ShowAt(TextBoxName); args.Cancel = true; return; } if (ComboBoxCategory.SelectedIndex == -1) { FlyoutWarmingText.Text = "Category cannot be empty!"; FlyoutWarming.ShowAt(ComboBoxCategory); args.Cancel = true; return; } if (string.IsNullOrWhiteSpace(TextBoxUnitPrice.Text)) { FlyoutWarmingText.Text = "Unit Price cannot be empty!"; FlyoutWarming.ShowAt(TextBoxUnitPrice); args.Cancel = true; return; } if (TextBoxRegex.GetIsValid(TextBoxUnitPrice) == false) { FlyoutWarmingText.Text = "Wrong numerical value!"; FlyoutWarming.ShowAt(TextBoxUnitPrice); args.Cancel = true; return; } // perform real update TextBoxName.GetBindingExpression(TextBox.TextProperty).UpdateSource(); ComboBoxCategory.GetBindingExpression(ComboBox.SelectedValueProperty).UpdateSource(); TextBoxUnitPrice.GetBindingExpression(TextBox.TextProperty).UpdateSource(); ImageThumbnail.GetBindingExpression(Image.SourceProperty).UpdateSource(); this.recipe.ThumbnailFilename = this.thumbnailFilename; }
private void Initialize() { this.InitializeComponent(); base.MaximizeBox = false; base.MinimizeBox = false; base.FormBorderStyle = FormBorderStyle.FixedDialog; this.tcRegistInfo = this.xmlComponentLoader1.GetControlByName <AisinoTAB>("tcRegistInfo"); this.tpBaseInfo = this.xmlComponentLoader1.GetControlByName <TabPage>("tpBaseInfo"); this.tpRegist = this.xmlComponentLoader1.GetControlByName <TabPage>("tpRegist"); this.tpLoadFiles = this.xmlComponentLoader1.GetControlByName <TabPage>("tpLoadFiles"); this.tpFileCheck = this.xmlComponentLoader1.GetControlByName <TabPage>("tpFileCheck"); this.numUdDays = this.xmlComponentLoader1.GetControlByName <AisinoNUD>("numUdDays"); this.numUDMachineNo = this.xmlComponentLoader1.GetControlByName <AisinoNUD>("numUDMachineNo"); this.numUdOutTime = this.xmlComponentLoader1.GetControlByName <AisinoNUD>("numUdOutTime"); this.txtName = this.xmlComponentLoader1.GetControlByName <AisinoTXT>("txtName"); this.txtTaxNo = this.xmlComponentLoader1.GetControlByName <AisinoTXT>("txtTaxNo"); this.txtLoadUri = this.xmlComponentLoader1.GetControlByName <AisinoTXT>("txtLoadUri"); this.rtxtInsVersions = this.xmlComponentLoader1.GetControlByName <AisinoRTX>("rtxtInsVersions"); this.rtxtVersion = this.xmlComponentLoader1.GetControlByName <AisinoRTX>("rtxtVersion"); this.btnSetupRegFile = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnSetupRegFile"); this.btnLoad = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnLoad"); this.btnRemove = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnRemove"); this.btnAdd = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnAdd"); this.btnExport = this.xmlComponentLoader1.GetControlByName <AisinoBTN>("btnExport"); this.chkOverdate = this.xmlComponentLoader1.GetControlByName <AisinoCHK>("chkOverdate"); this.chkBeforeDate = this.xmlComponentLoader1.GetControlByName <AisinoCHK>("chkBeforeDate"); this.lblBBH = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblBBH"); this.label6 = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("label6"); this.lblRJZL = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblRJZL"); this.lblRJXLH = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblRJXLH"); this.lblKPJH = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblKPJH"); this.lblZCDY = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblZCDY"); this.lblSQJZRQ = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblSQJZRQ"); this.lblRJBH = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblRJBH"); this.lblNSDJH = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblNSDJH"); this.tvRegVersion = this.xmlComponentLoader1.GetControlByName <AisinoTVW>("tvRegVersion"); this.txtAuthNo = this.xmlComponentLoader1.GetControlByName <TextBoxRegex>("txtAuthNo"); this.lstBoxAuthNo = this.xmlComponentLoader1.GetControlByName <AisinoLST>("lstBoxAuthNo"); this.numUDMachineNo.Enabled = false; this.txtAuthNo.IsEmpty = false; this.txtAuthNo.RegexText = "^[0-9]{0,20}$"; this.tvRegVersion.ImageList = this.imageList1; this.tvRegVersion.ImageIndex = 0; this.tvRegVersion.SelectedImageIndex = 0; this.chkBeforeDate.Visible = true; this.numUdDays.Visible = true; this.label6.Visible = true; this.chkOverdate.Visible = true; this.rtxtInsVersions.Visible = true; this.btnSetupRegFile.Visible = true; this.btnAdd.Click += new EventHandler(this.btnAdd_Click); this.btnRemove.Click += new EventHandler(this.btnRemove_Click); this.btnExport.Click += new EventHandler(this.btnExport_Click); this.btnLoad.Click += new EventHandler(this.btnLoad_Click); this.btnSetupRegFile.Click += new EventHandler(this.btnSetupRegFile_Click); this.txtAuthNo.TextChanged += new EventHandler(this.txtAuthNo_TextChanged); this.lstBoxAuthNo.SelectedIndexChanged += new EventHandler(this.lstBoxAuthNo_SelectedIndexChanged); this.tvRegVersion.AfterSelect += new TreeViewEventHandler(this.tvRegVersion_AfterSelect); this.tvRegVersion.MouseClick += new MouseEventHandler(this.tvRegVersion_MouseClick); this.delToolStripMenuItem.Click += new EventHandler(this.delToolStripMenuItem_Click); }
private async Task AddUser(string resource, Method method) { SubmitButton.IsEnabled = false; if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Password) && !string.IsNullOrEmpty(passwordconfirm.Password) && password.Password == passwordconfirm.Password && TextBoxRegex.GetIsValid(email)) { LoginModel SavedResponseObj = await helper.ReadFileAsync <LoginModel>("response"); AddUserModel userObj = new AddUserModel { UserName = username.Text.Trim(), Password = password.Password.Trim(), Name = name.Text.Trim(), Surname = surname.Text.Trim(), Email = email.Text.Trim(), Active = activity.IsChecked ?? true, UserType = usertype.SelectedItem.ToString() }; string json = JsonConvert.SerializeObject(userObj); RestClient client = new RestClient(IP.Adress); RestRequest request = new RestRequest(resource, method); _ = request.AddParameter("application/json", json, ParameterType.RequestBody); _ = request.AddParameter("Authorization", "Bearer " + SavedResponseObj.Token, ParameterType.HttpHeader); if (IsEditMode) { _ = request.AddParameter("id", UserID, ParameterType.UrlSegment); } IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { SubmitButton.IsEnabled = true; if (IsEditMode) { _ = await new CustomDialog("Użytkownik edytowany poprawnie.", null, CustomDialog.Type.Information).ShowAsync(); CleanupInput(); Frame rootFrame = Window.Current.Content as Frame; MainPage homePage = rootFrame.Content as MainPage; _ = homePage.NavigationFrame.Navigate(typeof(UsersPage), null, new DrillInNavigationTransitionInfo()); } else { _ = await new CustomDialog("Użytkownik stworzony poprawnie.", null, CustomDialog.Type.Information).ShowAsync(); CleanupInput(); } } else { _ = await new CustomDialog("Wystąpił błąd podczas komunikacji z serwerem.", response.StatusCode.ToString(), CustomDialog.Type.Error).ShowAsync(); SubmitButton.IsEnabled = true; } } else { _ = await new CustomDialog("Wprowadzono błędne dane.", null, CustomDialog.Type.Warning).ShowAsync(); SubmitButton.IsEnabled = true; } }
private bool IsFormValid() { CustomUri_TextBox_LostFocus(null, null); return(TextBoxRegex.GetIsValid(CustomUri_TextBox)); }
private async Task AddUser(string resource, Method method) { SubmitButton.IsEnabled = false; if (!string.IsNullOrEmpty(roomname.Text) && !string.IsNullOrEmpty(localization.Text) && TextBoxRegex.GetIsValid(numberofpeople)) { LoginModel SavedResponseObj = await helper.ReadFileAsync <LoginModel>("response"); AddRoomModel roomObj = new AddRoomModel { RoomName = roomname.Text.Trim(), Location = localization.Text.Trim(), Availability = availability.SelectedIndex + 1, NumberOfPeople = Convert.ToInt32(numberofpeople.Text) }; string json = JsonConvert.SerializeObject(roomObj); RestClient client = new RestClient(IP.Adress); RestRequest request = new RestRequest("Room/create", Method.POST); _ = request.AddParameter("application/json", json, ParameterType.RequestBody); _ = request.AddParameter("Authorization", "Bearer " + SavedResponseObj.Token, ParameterType.HttpHeader); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { _ = await new CustomDialog("Sala dodana poprawnie.", null, CustomDialog.Type.Information).ShowAsync(); SubmitButton.IsEnabled = true; } else { _ = await new CustomDialog("Wystąpił błąd podczas komunikacji z serwerem.", response.StatusCode.ToString(), CustomDialog.Type.Error).ShowAsync(); SubmitButton.IsEnabled = true; } } else { _ = await new CustomDialog("Wprowadzono błędne dane.", null, CustomDialog.Type.Warning).ShowAsync(); SubmitButton.IsEnabled = true; } }
internal void AddFilter(string v) { switch (v.ToLower()) { case "extensions": { if (string.IsNullOrEmpty(TextBoxExtension)) { return; } // Add leading dot if not present. if (!TextBoxExtension.StartsWith(".")) { TextBoxExtension = "." + TextBoxExtension; } Extensions.Add(TextBoxExtension.ToLower()); TextBoxExtension = string.Empty; break; } case "directories": { if (string.IsNullOrEmpty(TextBoxDirectories)) { return; } Directories.Add(TextBoxDirectories.ToLower()); TextBoxDirectories = string.Empty; break; } case "regex": { if (string.IsNullOrEmpty(TextBoxRegex)) { return; } Regexes.Add(TextBoxRegex.ToLower()); TextBoxRegex = string.Empty; break; } case "strings": { if (string.IsNullOrEmpty(TextBoxStrings)) { return; } Strings.Add(TextBoxStrings.ToLower()); TextBoxStrings = string.Empty; break; } default: break; } }
private void method_2() { ComponentResourceManager manager = new ComponentResourceManager(typeof(EmailCanShuSet)); this.btn_QueDing = new AisinoBTN(); this.btn_QuXiao = new AisinoBTN(); this.tabPage3 = new TabPage(); this.groupBox5 = new GroupBox(); this.chkBox_ServerDeleteEmail_GJ = new CheckBox(); this.groupBox7 = new GroupBox(); this.chkBox_SendItemSet_CG = new CheckBox(); this.chkBox_ZhiJieSend_CG = new CheckBox(); this.tabPage1 = new TabPage(); this.groupBox3 = new GroupBox(); this.btn_LinkTest_Send = new AisinoBTN(); this.chkBox_MyServerYanZheng_Send = new CheckBox(); this.textRegex_PassWord_Send = new TextBoxRegex(); this.label6 = new Label(); this.textRegex_ZhangHuMing_Send = new TextBoxRegex(); this.label5 = new Label(); this.groupBox2 = new GroupBox(); this.btn_LinkTest_Rece = new AisinoBTN(); this.textRegex_PassWord_Rece = new TextBoxRegex(); this.textRegex_ZhangHuMing_Rece = new TextBoxRegex(); this.label4 = new Label(); this.label3 = new Label(); this.groupBox1 = new GroupBox(); this.label14 = new Label(); this.label13 = new Label(); this.textRegex_ReceEmail_POP3_GJ = new TextBoxRegex(); this.textRegex_SendEmail_SMPT_GJ = new TextBoxRegex(); this.textRegex_SendEmail_SMTP = new TextBoxRegex(); this.textRegex_ReceEmail_POP3 = new TextBoxRegex(); this.label2 = new Label(); this.label1 = new Label(); this.tabControl1 = new TabControl(); this.tabPage3.SuspendLayout(); this.groupBox5.SuspendLayout(); this.groupBox7.SuspendLayout(); this.tabPage1.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.tabControl1.SuspendLayout(); base.SuspendLayout(); this.btn_QueDing.BackColorActive = Color.FromArgb(0x19, 0x76, 210); this.btn_QueDing.ColorDefaultA = Color.FromArgb(0, 0xac, 0xfb); this.btn_QueDing.ColorDefaultB = Color.FromArgb(0, 0x91, 0xe0); this.btn_QueDing.Font = new Font("微软雅黑", 9.75f, FontStyle.Bold); this.btn_QueDing.FontColor = Color.FromArgb(0xff, 0xff, 0xff); this.btn_QueDing.ForeColor = Color.White; this.btn_QueDing.Location = new Point(0x12a, 0x175); this.btn_QueDing.Name = "btn_QueDing"; this.btn_QueDing.Size = new Size(80, 30); this.btn_QueDing.TabIndex = 0; this.btn_QueDing.Text = "确定"; this.btn_QueDing.UseVisualStyleBackColor = true; this.btn_QueDing.Click += new EventHandler(this.btn_QueDing_Click); this.btn_QuXiao.BackColorActive = Color.FromArgb(0x19, 0x76, 210); this.btn_QuXiao.ColorDefaultA = Color.FromArgb(0, 0xac, 0xfb); this.btn_QuXiao.ColorDefaultB = Color.FromArgb(0, 0x91, 0xe0); this.btn_QuXiao.Font = new Font("微软雅黑", 9.75f, FontStyle.Bold); this.btn_QuXiao.FontColor = Color.FromArgb(0xff, 0xff, 0xff); this.btn_QuXiao.ForeColor = Color.White; this.btn_QuXiao.Location = new Point(0x184, 0x175); this.btn_QuXiao.Name = "btn_QuXiao"; this.btn_QuXiao.Size = new Size(80, 30); this.btn_QuXiao.TabIndex = 2; this.btn_QuXiao.Text = "取消"; this.btn_QuXiao.UseVisualStyleBackColor = true; this.tabPage3.Controls.Add(this.groupBox5); this.tabPage3.Controls.Add(this.groupBox7); this.tabPage3.Location = new Point(4, 0x16); this.tabPage3.Name = "tabPage3"; this.tabPage3.Size = new Size(0x1c0, 320); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "其它"; this.tabPage3.UseVisualStyleBackColor = true; this.groupBox5.Controls.Add(this.chkBox_ServerDeleteEmail_GJ); this.groupBox5.Font = new Font("微软雅黑", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.groupBox5.Location = new Point(0x16, 20); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new Size(0x17d, 0x48); this.groupBox5.TabIndex = 8; this.groupBox5.TabStop = false; this.groupBox5.Text = "邮件副本"; this.chkBox_ServerDeleteEmail_GJ.AutoSize = true; this.chkBox_ServerDeleteEmail_GJ.Font = new Font("微软雅黑", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.chkBox_ServerDeleteEmail_GJ.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.chkBox_ServerDeleteEmail_GJ.Location = new Point(0x16, 0x22); this.chkBox_ServerDeleteEmail_GJ.Name = "chkBox_ServerDeleteEmail_GJ"; this.chkBox_ServerDeleteEmail_GJ.Size = new Size(0xf3, 0x15); this.chkBox_ServerDeleteEmail_GJ.TabIndex = 0; this.chkBox_ServerDeleteEmail_GJ.Text = "成功接收邮件后,从邮件服务器删除邮件"; this.chkBox_ServerDeleteEmail_GJ.UseVisualStyleBackColor = true; this.groupBox7.Controls.Add(this.chkBox_SendItemSet_CG); this.groupBox7.Controls.Add(this.chkBox_ZhiJieSend_CG); this.groupBox7.Font = new Font("微软雅黑", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.groupBox7.Location = new Point(0x16, 0x74); this.groupBox7.Name = "groupBox7"; this.groupBox7.Size = new Size(0x17d, 100); this.groupBox7.TabIndex = 3; this.groupBox7.TabStop = false; this.groupBox7.Text = "发票填开打印后……"; this.chkBox_SendItemSet_CG.AutoSize = true; this.chkBox_SendItemSet_CG.Font = new Font("微软雅黑", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.chkBox_SendItemSet_CG.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.chkBox_SendItemSet_CG.Location = new Point(30, 0x43); this.chkBox_SendItemSet_CG.Name = "chkBox_SendItemSet_CG"; this.chkBox_SendItemSet_CG.Size = new Size(0xc3, 0x15); this.chkBox_SendItemSet_CG.TabIndex = 1; this.chkBox_SendItemSet_CG.Text = "每次发送时都进行发送选项设置"; this.chkBox_SendItemSet_CG.UseVisualStyleBackColor = true; this.chkBox_ZhiJieSend_CG.AutoSize = true; this.chkBox_ZhiJieSend_CG.Font = new Font("微软雅黑", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.chkBox_ZhiJieSend_CG.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.chkBox_ZhiJieSend_CG.Location = new Point(30, 0x1f); this.chkBox_ZhiJieSend_CG.Name = "chkBox_ZhiJieSend_CG"; this.chkBox_ZhiJieSend_CG.Size = new Size(0xb7, 0x15); this.chkBox_ZhiJieSend_CG.TabIndex = 0; this.chkBox_ZhiJieSend_CG.Text = "发票填开打印后直接进行发送"; this.chkBox_ZhiJieSend_CG.UseVisualStyleBackColor = true; this.tabPage1.Controls.Add(this.groupBox3); this.tabPage1.Controls.Add(this.groupBox2); this.tabPage1.Controls.Add(this.groupBox1); this.tabPage1.Location = new Point(4, 0x16); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new Padding(3); this.tabPage1.Size = new Size(0x1c0, 320); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "邮件服务器"; this.tabPage1.UseVisualStyleBackColor = true; this.groupBox3.Controls.Add(this.btn_LinkTest_Send); this.groupBox3.Controls.Add(this.chkBox_MyServerYanZheng_Send); this.groupBox3.Controls.Add(this.textRegex_PassWord_Send); this.groupBox3.Controls.Add(this.label6); this.groupBox3.Controls.Add(this.textRegex_ZhangHuMing_Send); this.groupBox3.Controls.Add(this.label5); this.groupBox3.Font = new Font("微软雅黑", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.groupBox3.Location = new Point(6, 0xc3); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new Size(0x1b4, 0x6f); this.groupBox3.TabIndex = 2; this.groupBox3.TabStop = false; this.groupBox3.Text = "邮件发送服务器"; this.btn_LinkTest_Send.BackColorActive = Color.FromArgb(0x19, 0x76, 210); this.btn_LinkTest_Send.ColorDefaultA = Color.FromArgb(0, 0xac, 0xfb); this.btn_LinkTest_Send.ColorDefaultB = Color.FromArgb(0, 0x91, 0xe0); this.btn_LinkTest_Send.Font = new Font("微软雅黑", 9.75f, FontStyle.Bold); this.btn_LinkTest_Send.FontColor = Color.FromArgb(0xff, 0xff, 0xff); this.btn_LinkTest_Send.ForeColor = Color.White; this.btn_LinkTest_Send.Location = new Point(0x163, 0x35); this.btn_LinkTest_Send.Name = "btn_LinkTest_Send"; this.btn_LinkTest_Send.Size = new Size(0x47, 0x27); this.btn_LinkTest_Send.TabIndex = 12; this.btn_LinkTest_Send.Text = "连接测试"; this.btn_LinkTest_Send.UseVisualStyleBackColor = true; this.btn_LinkTest_Send.Visible = false; this.btn_LinkTest_Send.Click += new EventHandler(this.btn_LinkTest_Send_Click); this.chkBox_MyServerYanZheng_Send.AutoSize = true; this.chkBox_MyServerYanZheng_Send.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.chkBox_MyServerYanZheng_Send.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.chkBox_MyServerYanZheng_Send.Location = new Point(0x15, 20); this.chkBox_MyServerYanZheng_Send.Name = "chkBox_MyServerYanZheng_Send"; this.chkBox_MyServerYanZheng_Send.Size = new Size(0x9c, 0x10); this.chkBox_MyServerYanZheng_Send.TabIndex = 0; this.chkBox_MyServerYanZheng_Send.Text = "我的服务器要求身份验证"; this.chkBox_MyServerYanZheng_Send.UseVisualStyleBackColor = true; this.textRegex_PassWord_Send.Location = new Point(0x4e, 80); this.textRegex_PassWord_Send.MaxLength = 200; this.textRegex_PassWord_Send.Name = "textRegex_PassWord_Send"; this.textRegex_PassWord_Send.PasswordChar = '*'; this.textRegex_PassWord_Send.RegexText = ""; this.textRegex_PassWord_Send.Size = new Size(0x109, 0x17); this.textRegex_PassWord_Send.TabIndex = 11; this.label6.AutoSize = true; this.label6.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.label6.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.label6.Location = new Point(0x13, 0x53); this.label6.Name = "label6"; this.label6.Size = new Size(0x35, 12); this.label6.TabIndex = 11; this.label6.Text = "密 码:"; this.textRegex_ZhangHuMing_Send.Location = new Point(0x4e, 0x2c); this.textRegex_ZhangHuMing_Send.MaxLength = 200; this.textRegex_ZhangHuMing_Send.Name = "textRegex_ZhangHuMing_Send"; this.textRegex_ZhangHuMing_Send.RegexText = ""; this.textRegex_ZhangHuMing_Send.Size = new Size(0x109, 0x17); this.textRegex_ZhangHuMing_Send.TabIndex = 10; this.label5.AutoSize = true; this.label5.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.label5.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.label5.Location = new Point(0x13, 0x2f); this.label5.Name = "label5"; this.label5.Size = new Size(0x35, 12); this.label5.TabIndex = 10; this.label5.Text = "账户名:"; this.groupBox2.Controls.Add(this.btn_LinkTest_Rece); this.groupBox2.Controls.Add(this.textRegex_PassWord_Rece); this.groupBox2.Controls.Add(this.textRegex_ZhangHuMing_Rece); this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.label3); this.groupBox2.Font = new Font("微软雅黑", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.groupBox2.Location = new Point(6, 0x5e); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new Size(0x1b4, 0x56); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "邮件接收服务器"; this.btn_LinkTest_Rece.BackColorActive = Color.FromArgb(0x19, 0x76, 210); this.btn_LinkTest_Rece.ColorDefaultA = Color.FromArgb(0, 0xac, 0xfb); this.btn_LinkTest_Rece.ColorDefaultB = Color.FromArgb(0, 0x91, 0xe0); this.btn_LinkTest_Rece.Font = new Font("微软雅黑", 9.75f, FontStyle.Bold); this.btn_LinkTest_Rece.FontColor = Color.FromArgb(0xff, 0xff, 0xff); this.btn_LinkTest_Rece.ForeColor = Color.White; this.btn_LinkTest_Rece.Location = new Point(0x163, 0x20); this.btn_LinkTest_Rece.Name = "btn_LinkTest_Rece"; this.btn_LinkTest_Rece.Size = new Size(0x47, 0x25); this.btn_LinkTest_Rece.TabIndex = 9; this.btn_LinkTest_Rece.Text = "连接测试"; this.btn_LinkTest_Rece.UseVisualStyleBackColor = true; this.btn_LinkTest_Rece.Click += new EventHandler(this.btn_LinkTest_Rece_Click); this.textRegex_PassWord_Rece.Location = new Point(0x4e, 0x36); this.textRegex_PassWord_Rece.MaxLength = 200; this.textRegex_PassWord_Rece.Name = "textRegex_PassWord_Rece"; this.textRegex_PassWord_Rece.PasswordChar = '*'; this.textRegex_PassWord_Rece.RegexText = ""; this.textRegex_PassWord_Rece.Size = new Size(0x109, 0x17); this.textRegex_PassWord_Rece.TabIndex = 8; this.textRegex_ZhangHuMing_Rece.Location = new Point(0x4e, 0x15); this.textRegex_ZhangHuMing_Rece.MaxLength = 200; this.textRegex_ZhangHuMing_Rece.Name = "textRegex_ZhangHuMing_Rece"; this.textRegex_ZhangHuMing_Rece.RegexText = ""; this.textRegex_ZhangHuMing_Rece.Size = new Size(0x109, 0x17); this.textRegex_ZhangHuMing_Rece.TabIndex = 7; this.label4.AutoSize = true; this.label4.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.label4.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.label4.Location = new Point(0x13, 0x1b); this.label4.Name = "label4"; this.label4.Size = new Size(0x35, 12); this.label4.TabIndex = 4; this.label4.Text = "账户名:"; this.label3.AutoSize = true; this.label3.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.label3.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.label3.Location = new Point(0x13, 60); this.label3.Name = "label3"; this.label3.Size = new Size(0x35, 12); this.label3.TabIndex = 5; this.label3.Text = "密 码:"; this.groupBox1.Controls.Add(this.label14); this.groupBox1.Controls.Add(this.label13); this.groupBox1.Controls.Add(this.textRegex_ReceEmail_POP3_GJ); this.groupBox1.Controls.Add(this.textRegex_SendEmail_SMPT_GJ); this.groupBox1.Controls.Add(this.textRegex_SendEmail_SMTP); this.groupBox1.Controls.Add(this.textRegex_ReceEmail_POP3); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Font = new Font("微软雅黑", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.groupBox1.Location = new Point(6, 6); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new Size(0x1b4, 0x52); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "服务器信息"; this.label14.AutoSize = true; this.label14.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.label14.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.label14.Location = new Point(0x12f, 0x35); this.label14.Name = "label14"; this.label14.Size = new Size(0x29, 12); this.label14.TabIndex = 11; this.label14.Text = "端口:"; this.label13.AutoSize = true; this.label13.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.label13.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.label13.Location = new Point(0x12f, 0x11); this.label13.Name = "label13"; this.label13.Size = new Size(0x29, 12); this.label13.TabIndex = 10; this.label13.Text = "端口:"; this.textRegex_ReceEmail_POP3_GJ.Location = new Point(350, 0x11); this.textRegex_ReceEmail_POP3_GJ.MaxLength = 10; this.textRegex_ReceEmail_POP3_GJ.Name = "textRegex_ReceEmail_POP3_GJ"; this.textRegex_ReceEmail_POP3_GJ.RegexText = ""; this.textRegex_ReceEmail_POP3_GJ.Size = new Size(0x45, 0x17); this.textRegex_ReceEmail_POP3_GJ.TabIndex = 4; this.textRegex_SendEmail_SMPT_GJ.Location = new Point(350, 50); this.textRegex_SendEmail_SMPT_GJ.MaxLength = 10; this.textRegex_SendEmail_SMPT_GJ.Name = "textRegex_SendEmail_SMPT_GJ"; this.textRegex_SendEmail_SMPT_GJ.RegexText = ""; this.textRegex_SendEmail_SMPT_GJ.Size = new Size(0x45, 0x17); this.textRegex_SendEmail_SMPT_GJ.TabIndex = 6; this.textRegex_SendEmail_SMTP.Location = new Point(0x9d, 50); this.textRegex_SendEmail_SMTP.MaxLength = 200; this.textRegex_SendEmail_SMTP.Name = "textRegex_SendEmail_SMTP"; this.textRegex_SendEmail_SMTP.RegexText = ""; this.textRegex_SendEmail_SMTP.Size = new Size(0x7c, 0x17); this.textRegex_SendEmail_SMTP.TabIndex = 5; this.textRegex_ReceEmail_POP3.Location = new Point(0x9d, 0x11); this.textRegex_ReceEmail_POP3.MaxLength = 200; this.textRegex_ReceEmail_POP3.Name = "textRegex_ReceEmail_POP3"; this.textRegex_ReceEmail_POP3.RegexText = ""; this.textRegex_ReceEmail_POP3.Size = new Size(0x7c, 0x17); this.textRegex_ReceEmail_POP3.TabIndex = 3; this.label2.AutoSize = true; this.label2.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.label2.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.label2.Location = new Point(0x13, 0x38); this.label2.Name = "label2"; this.label2.Size = new Size(0x7d, 12); this.label2.TabIndex = 1; this.label2.Text = "发送服务器(SMTP):"; this.label1.AutoSize = true; this.label1.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86); this.label1.ForeColor = Color.FromArgb(2, 0x3d, 0x7f); this.label1.Location = new Point(0x13, 0x17); this.label1.Name = "label1"; this.label1.Size = new Size(0x7d, 12); this.label1.TabIndex = 0; this.label1.Text = "接收服务器(POP3):"; this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Location = new Point(12, 12); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new Size(0x1c8, 0x15a); this.tabControl1.TabIndex = 0; base.AutoScaleDimensions = new SizeF(6f, 12f); base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(0x1dd, 0x1a6); base.Controls.Add(this.btn_QuXiao); base.Controls.Add(this.btn_QueDing); base.Controls.Add(this.tabControl1); base.FormBorderStyle = FormBorderStyle.FixedSingle; base.Icon = (Icon)manager.GetObject("$this.Icon"); base.Name = "EmailCanShuSet"; base.StartPosition = FormStartPosition.CenterParent; this.Text = "邮件参数设置"; this.tabPage3.ResumeLayout(false); this.groupBox5.ResumeLayout(false); this.groupBox5.PerformLayout(); this.groupBox7.ResumeLayout(false); this.groupBox7.PerformLayout(); this.tabPage1.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.tabControl1.ResumeLayout(false); base.ResumeLayout(false); }
private async void SignIn_Button(object sejnder, RoutedEventArgs e) { SubmitButton.IsEnabled = false; if (!string.IsNullOrEmpty(password.Password) && TextBoxRegex.GetIsValid(email) && NetworkInterface.GetIsNetworkAvailable()) { SignInModel loginObj = new SignInModel { Email = email.Text, Password = password.Password, }; string json = JsonConvert.SerializeObject(loginObj); ConnectionModel IP = new ConnectionModel(); RestClient client = new RestClient(IP.Adress); RestRequest request = new RestRequest("Account/login", Method.POST); _ = request.AddParameter("application/json", json, ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.StatusCode != System.Net.HttpStatusCode.InternalServerError && response.StatusCode != System.Net.HttpStatusCode.NotFound && response.StatusCode != System.Net.HttpStatusCode.BadGateway && response.StatusCode != System.Net.HttpStatusCode.BadRequest && response.StatusCode != 0) { LoginModel tokenObj = JsonConvert.DeserializeObject <LoginModel>(response.Content); JwtSecurityTokenHandler handler = new JwtSecurityTokenHandler(); SecurityToken jsonToken = handler.ReadToken(tokenObj.Token); LoginModel tokenvalidateObj = new LoginModel { UserName = ((JwtSecurityToken)jsonToken).Payload["userName"].ToString(), Name = ((JwtSecurityToken)jsonToken).Payload["name"].ToString(), surName = ((JwtSecurityToken)jsonToken).Payload["sureName"].ToString(), Email = ((JwtSecurityToken)jsonToken).Payload["email"].ToString(), role = ((JwtSecurityToken)jsonToken).Payload["role"].ToString(), Token = tokenObj.Token, IsLoged = true }; if (response.StatusCode == System.Net.HttpStatusCode.OK) { _ = await helper.SaveFileAsync("response", tokenvalidateObj); SubmitButton.IsEnabled = true; _ = Frame.Navigate(typeof(MainPage), null, new DrillInNavigationTransitionInfo()); } else { _ = await new CustomDialog("Wystąpił błąd podczas komunikacji z serwerem.", response.StatusCode.ToString(), CustomDialog.Type.Error).ShowAsync(); SubmitButton.IsEnabled = true; } } else { _ = await new CustomDialog("Konto o podanym loginie/haśle nie istnieje lub brak połączenia z serwerem.", response.StatusCode.ToString(), CustomDialog.Type.Error).ShowAsync(); SubmitButton.IsEnabled = true; } } else { _ = await new CustomDialog("Wprowadzono błędne dane lub brak połączenia z internetem.", null, CustomDialog.Type.Warning).ShowAsync(); SubmitButton.IsEnabled = true; } }