private void Window_Loaded(object sender, RoutedEventArgs e) { InitClassShow(); var bindExp = TextBox_Name.GetBindingExpression(TextBox.TextProperty); if(bindExp != null) { if(bindExp.ParentBinding.ValidationRules.Count > 0) { var rule = bindExp.ParentBinding.ValidationRules[0] as InputWindow.RequiredRule; if(rule != null) { rule.OnValidateCheck = (object value, System.Globalization.CultureInfo cultureInfo) => { var val = (string)value; if (string.IsNullOrEmpty(val)) return new ValidationResult(false, "名称不能为空!"); if(EditorCommon.Program.IsValidRName(val) == false) return new ValidationResult(false, "名称不合法!"); var files = EngineNS.CEngine.Instance.FileManager.GetFiles(FolderData.AbsFolder, val + EngineNS.CEngineDesc.MacrossExtension + EditorCommon.Program.ResourceInfoExt, System.IO.SearchOption.AllDirectories); if (files.Count > 0) return new ValidationResult(false, "已包含同名Macross"); return new ValidationResult(true, null); }; } } } }
private void Btn_Insert_Click(object sender, RoutedEventArgs e) { try { if (TextBox_Name.Text == "" || TextBox_Address.Text == "" || TextBox_Email.Text == "") { if (TextBox_Name.Text == "") { MessageBox.Show("Name is required", "Warning", MessageBoxButton.OK); TextBox_Name.Focus(); } else if (TextBox_Address.Text == "") { MessageBox.Show("Address is required", "Warning", MessageBoxButton.OK); TextBox_Address.Focus(); } else if (TextBox_Email.Text == "") { MessageBox.Show("Email is required", "Warning", MessageBoxButton.OK); TextBox_Email.Focus(); } } else { var check_email = connection.Suppliers.FirstOrDefault(S => S.Email == TextBox_Email.Text); if (check_email == null) { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are You Sure?", "Insert Confirmation", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { var input_supplier = new Supplier(TextBox_Name.Text, TextBox_Address.Text, TextBox_Email.Text); connection.Suppliers.Add(input_supplier); var insert = connection.SaveChanges(); if (insert >= 1) { MessageBox.Show(insert + " Supplier has been inserted"); } TB_M_Supplier.ItemsSource = connection.Suppliers.ToList(); } } else { MessageBox.Show("Email has been used"); } } } catch (Exception) { } reset_supplier(); Combo_Supplier.ItemsSource = connection.Suppliers.ToList(); }
private void Button_Select_Click(object sender, RoutedEventArgs e) { if (TextBox_Name != null) { if (Validation.GetHasError(TextBox_Name)) { return; } var bindExp = TextBox_Name.GetBindingExpression(TextBox.TextProperty); if (bindExp != null) { if (bindExp.ParentBinding.ValidationRules.Count > 0) { var rule = bindExp.ParentBinding.ValidationRules[0] as InputWindow.RequiredRule; if (rule != null) { rule.OnValidateCheck = null; } } } var bindingExpression = TextBox_Name.GetBindingExpression(TextBox.TextProperty); if (bindingExpression != null) { bindingExpression.UpdateSource(); } } if (mCreateData.ClassType == null) { return; } DialogResult = true; this.Close(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { InitMaps(); var bindExp = TextBox_Name.GetBindingExpression(TextBox.TextProperty); if (bindExp != null) { if (bindExp.ParentBinding.ValidationRules.Count > 0) { var rule = bindExp.ParentBinding.ValidationRules[0] as InputWindow.RequiredRule; if (rule != null) { rule.OnValidateCheck = (object value, System.Globalization.CultureInfo cultureInfo) => { var val = (string)value; if (string.IsNullOrEmpty(val)) { return(new ValidationResult(false, "名称不能为空!")); } if (EditorCommon.Program.IsValidRName(val) == false) { return(new ValidationResult(false, "名称不合法!")); } return(new ValidationResult(true, null)); }; } } } ListBox_Maps.SelectedIndex = 0; }
public bool?ShowDialog(Delegate_ValidateCheck onCheck) { try { if (TextBox_Name != null) { var bindExp = TextBox_Name.GetBindingExpression(TextBox.TextProperty); if (bindExp != null) { if (bindExp.ParentBinding.ValidationRules.Count > 0) { var rule = bindExp.ParentBinding.ValidationRules[0] as InputWindow.RequiredRule; if (rule != null) { rule.OnValidateCheck = onCheck; } } } } return(this.ShowDialog()); } catch (System.Exception ex) { EngineNS.Profiler.Log.WriteLine(EngineNS.Profiler.ELogTag.Error, "Create Resource Exception", ex.ToString()); } return(false); }
private void clear() { TextBox_ID.Clear(); TextBox_Name.Clear(); TextBox_price.Clear(); TextBox_Qty.Clear(); ComboBox_category.SelectedIndex = 0; }
private void HideItemDetailComponents() { Label_Start.Hide(); Label_Name.Hide(); TextBox_Name.Hide(); ComboBox_Start.Hide(); Button_Save.Hide(); }
private void ShowItemDetailComponents() { Label_Start.Show(); Label_Name.Show(); TextBox_Name.Show(); ComboBox_Start.Show(); Button_Save.Show(); }
private void clear() { TextBox_ID.Clear(); TextBox_Name.Clear(); TextBox_age.Clear(); TextBox_Phone.Clear(); TextBox_password.Clear(); }
private void UserControl_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { mOldObjectName = TLObjectName; TextBlock_Name.Visibility = Visibility.Collapsed; TextBox_Name.Visibility = Visibility.Visible; //Keyboard.Focus(TextBox_Name); TextBox_Name.SelectAll(); }
/// <summary> /// 重置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { staticName = ""; staticCardNo = ""; staticStartTime = ""; staticEndTime = ""; dateTimeStart.Text = ""; dateTimeEnd.Text = ""; TextBox_CardNo.Clear(); TextBox_Name.Clear(); pageControl.CurrentPage = 1; InitDataGrid(); }
private void CreatePredator() { Notification msg; if (TextBox_Name.Text != "") { string name = TextBox_Name.Text; foreach (Predator p in IPredators) { if (p.Name == name) { msg = new Notification("Nombre ocupado."); msg.ShowDialog(); return; } } foreach (Prey p in IPreys) { if (p.Name == name) { msg = new Notification("Nombre ocupado."); msg.ShowDialog(); return; } } IPredators.Add(new Predator(TemporalPicture, name, (Vertex)ComboBox_Start.SelectedItem, TemporalCharacter)); AvailableVertices.RemoveAt(ComboBox_Start.SelectedIndex); msg = new Notification("Depredador creado exitosamente."); msg.ShowDialog(); TextBox_Name.ResetText(); HideItemDetailComponents(); } else { msg = new Notification("El campo Nombre es obligatorio."); msg.ShowDialog(); } }
private void Button_OK_Click(object sender, RoutedEventArgs e) { if (TextBox_Name != null) { if (Validation.GetHasError(TextBox_Name)) { return; } var bindExp = TextBox_Name.GetBindingExpression(TextBox.TextProperty); if (bindExp != null) { if (bindExp.ParentBinding.ValidationRules.Count > 0) { var rule = bindExp.ParentBinding.ValidationRules[0] as InputWindow.RequiredRule; if (rule != null) { rule.OnValidateCheck = null; } } } var bindingExpression = TextBox_Name.GetBindingExpression(TextBox.TextProperty); if (bindingExpression != null) { bindingExpression.UpdateSource(); } } if (ListBox_Maps.SelectedIndex < 0) { EditorCommon.MessageBox.Show("请先选择一张地图再进行创建"); return; } var item = ListBox_Maps.SelectedItem as MapData; mCreateData.SrcSceneName = item.MapRName; DialogResult = true; this.Close(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { mCreateData.ClassType = typeof(EngineNS.GamePlay.Component.StateMachine.McStateMachineComponent); mCreateData.IsMacrossType = false; mCreateData.CSType = EngineNS.ECSType.All; var bindExp = TextBox_Name.GetBindingExpression(TextBox.TextProperty); if (bindExp != null) { if (bindExp.ParentBinding.ValidationRules.Count > 0) { var rule = bindExp.ParentBinding.ValidationRules[0] as InputWindow.RequiredRule; if (rule != null) { rule.OnValidateCheck = (object value, System.Globalization.CultureInfo cultureInfo) => { var val = (string)value; if (string.IsNullOrEmpty(val)) { return(new ValidationResult(false, "名称不能为空!")); } if (EditorCommon.Program.IsValidRName(val) == false) { return(new ValidationResult(false, "名称不合法!")); } var files = EngineNS.CEngine.Instance.FileManager.GetFiles(EngineNS.CEngine.Instance.FileManager.ProjectContent, val + EngineNS.CEngineDesc.MacrossExtension + EditorCommon.Program.ResourceInfoExt, System.IO.SearchOption.AllDirectories); if (files.Count > 0) { return(new ValidationResult(false, "已包含同名Macross")); } return(new ValidationResult(true, null)); }; } } } }
public Win() { InitializeComponent(); TextBox_Name.Focus(); }
private void clear() { TextBox_ID.Clear(); TextBox_Name.Clear(); TextBox_description.Clear(); }
private RenamingNodeItemView() { InitializeComponent(); this.WhenActivated(d => { this.Bind(ViewModel, vm => vm.NewName, v => v.TextBox_Name.Text).DisposeWith(d); this.BindCommand(ViewModel, vm => vm.RenameCommand, v => v.TextBox_Name, vm => vm.ChangedName, nameof(TextBox_Name.LostKeyboardFocus)).DisposeWith(d); this.OneWayBind(ViewModel, vm => vm.NewNameErrors, v => v.ShowErrorsBehavior_TextBox_Name.Errors).DisposeWith(d); this.WhenAnyObservable(v => v.ViewModel.IsFocus).ObserveOnDispatcher(DispatcherPriority.Background).Subscribe(u => TextBox_Name.Focus()).DisposeWith(d); }); }
private void ItemInfoUpdate(EditMode mode) { bool addItem = false; bool isNull = false; switch (mode) { case EditMode.EditTab: TabItemModel tab = (TabItemModel)this.ListBox_Tab.SelectedItem; if (tab != null) { this.TextBox_Command.Text = null; this.TextBox_Command.Visibility = Visibility.Hidden; this.TextBox_Name.Text = tab.Data.Name; this.TextBox_Description.Text = tab.Data.Description; } else { isNull = true; } break; case EditMode.EditString: StrItemModel str = (StrItemModel)this.ListBox_Str.SelectedItem; if (str != null) { this.TextBox_Command.Text = str.Data.Text; this.TextBox_Command.Visibility = Visibility.Visible; this.TextBox_Name.Text = str.Data.Name; this.TextBox_Description.Text = str.Data.Description; } else { isNull = true; } break; case EditMode.AddTab: addItem = true; this.TextBox_Command.Text = ""; this.TextBox_Command.Visibility = Visibility.Hidden; this.TextBox_Name.Text = "New Tab"; this.TextBox_Description.Text = "無"; break; case EditMode.AddString: addItem = true; this.TextBox_Command.Text = ""; this.TextBox_Command.Visibility = Visibility.Visible; this.TextBox_Name.Text = "New String"; this.TextBox_Description.Text = "無"; break; } if (addItem) { TextBox_Name.Focus(); EditApplyIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.AddThick; EditCancelIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.CloseThick; } else { EditApplyIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.CheckBold; EditCancelIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowRotateLeft; } if (!isNull) { editMode = mode; } InfoChangeCheck(); }
private void ClearButtonContent() { TextBox_Name.Clear(); TextBox_Age.Clear(); TextBox_Adress.Clear(); }