Ejemplo n.º 1
0
 private void QuickAddElement()
 {
     using (QuickAddElementDialog dialog = new QuickAddElementDialog())
     {
         dialog.EnsureButtonClick += (sender1, e1) =>
         {
             LocalizedMessageResult result = LocalizedMessageBox.Show(Properties.Resources.Message_Tooltip, LocalizedMessageButton.OKCancel, LocalizedMessageIcon.Warning);
             if (result == LocalizedMessageResult.Yes)
             {
                 tables.Clear();
                 if (!(bool)dialog.checkbox.IsChecked)
                 {
                     AddElementByAllRoutine();
                 }
                 else
                 {
                     if (dialog.combox1.SelectedIndex == 0)
                     {
                         AddElementByAllRoutine();
                     }
                     else
                     {
                         if ((bool)dialog.checkbox1.IsChecked && dialog.combox.SelectedIndex == 1)
                         {
                             int startIndex = int.Parse(dialog.textbox1.Text);
                             int endIndex   = int.Parse(dialog.textbox2.Text);
                             if (startIndex > endIndex)
                             {
                                 LocalizedMessageBox.Show(string.Format(Properties.Resources.Message_Network_Range_Error), LocalizedMessageIcon.Error);
                                 return;
                             }
                             else
                             {
                                 AddElementByCurrentRoutine(false, startIndex, endIndex);
                             }
                         }
                         else
                         {
                             AddElementByCurrentRoutine(true, 0, 0);
                         }
                     }
                 }
                 ShowTable(0);
                 dialog.Close();
                 Manager.Initialize();
             }
         };
         dialog.ShowDialog();
     }
 }
Ejemplo n.º 2
0
        private void InitializeButton(LocalizedMessageButton button)
        {
            switch (button)
            {
            case LocalizedMessageButton.YesNo:
                SetButtons(new Button[] { Button_1, Button_2 });
                Button_1.Content = Properties.Resources.YES;
                Button_2.Content = Properties.Resources.NO;
                Button_1.Click  += (sender, e) => { _result = LocalizedMessageResult.Yes; Close(); };
                Button_2.Click  += (sender, e) => { _result = LocalizedMessageResult.No; Close(); };
                break;

            case LocalizedMessageButton.YesNoCancel:
                SetButtons(new Button[] { Button_1, Button_2, Button_3 });
                Button_1.Content = Properties.Resources.YES;
                Button_2.Content = Properties.Resources.NO;
                Button_3.Content = Properties.Resources.Cancel;
                Button_1.Click  += (sender, e) => { _result = LocalizedMessageResult.Yes; Close(); };
                Button_2.Click  += (sender, e) => { _result = LocalizedMessageResult.No; Close(); };
                Button_3.Click  += (sender, e) => { _result = LocalizedMessageResult.Cancel; Close(); };
                break;

            case LocalizedMessageButton.OK:
                SetButtons(new Button[] { Button_1 });
                Button_1.Content = Properties.Resources.Ensure;
                Button_1.Click  += (sender, e) => { _result = LocalizedMessageResult.Yes; Close(); };
                break;

            case LocalizedMessageButton.OKCancel:
                SetButtons(new Button[] { Button_1, Button_2 });
                Button_1.Content = Properties.Resources.Ensure;
                Button_2.Content = Properties.Resources.Cancel;
                Button_1.Click  += (sender, e) => { _result = LocalizedMessageResult.Yes; Close(); };
                Button_2.Click  += (sender, e) => { _result = LocalizedMessageResult.No; Close(); };
                break;

            default:
                break;
            }
        }
Ejemplo n.º 3
0
        private void EnsureButton_Click(object sender, RoutedEventArgs e)
        {
            if (IsSettingChecked && File.Exists(PathContent + @"\" + NameContent + "." + FileHelper.ExtensionName))
            {
                string title = Properties.Resources.Message_Is_Override;
                string text  = String.Format("{2:s} {1},{0}?", Properties.Resources.Message_Is_Override, Properties.Resources.Message_Already_Exist, NameContent);
                LocalizedMessageResult mbret = LocalizedMessageBox.Show(text, title, LocalizedMessageButton.YesNoCancel, LocalizedMessageIcon.Warning);
                switch (mbret)
                {
                case LocalizedMessageResult.Yes:
                    break;

                case LocalizedMessageResult.No:
                case LocalizedMessageResult.Cancel:
                default:
                    return;
                }
            }
            if (EnsureButtonClick != null)
            {
                EnsureButtonClick.Invoke(this, new RoutedEventArgs());
            }
        }