public void OnEnsureButtonClick(object sender, RoutedEventArgs e)
 {
     if (EnsureButtonClick != null)
     {
         EnsureButtonClick.Invoke(sender, e);
     }
 }
 private void EnsureButton_Click(object sender, RoutedEventArgs e)
 {
     if (EnsureButtonClick != null)
     {
         EnsureButtonClick.Invoke(this, new RoutedEventArgs());
     }
 }
Beispiel #3
0
        private void EnsureButton_Click(object sender, RoutedEventArgs e)
        {
            ElementAddressType Type   = (ElementAddressType)Enum.ToObject(typeof(ElementAddressType), comboBox.SelectedIndex);
            Device             device = PLCDeviceManager.GetPLCDeviceManager().SelectDevice;

            if (Type == ElementAddressType.H || Type == ElementAddressType.K)
            {
                LocalizedMessageBox.Show(Properties.Resources.Constant_Monitor, LocalizedMessageIcon.Warning);
            }
            else if (ElementAddressHelper.AssertAddrRange(Type, uint.Parse(textBox.Text), device))
            {
                if ((bool)checkbox1.IsChecked && !ElementAddressHelper.AssertAddrRange(ElementAddressHelper.GetIntrasegmentAddrType(comboBox1.SelectedIndex), uint.Parse(textBox1.Text), device))
                {
                    LocalizedMessageBox.Show(Properties.Resources.Intra_Cross, LocalizedMessageIcon.Warning);
                }
                else if ((bool)checkbox.IsChecked && !ElementAddressHelper.AssertAddrRange(Type, uint.Parse(textBox.Text) + uint.Parse(rangeTextBox.GetTextBox().Text) - 1, device))
                {
                    LocalizedMessageBox.Show(Properties.Resources.Exceed_Adddress, LocalizedMessageIcon.Warning);
                }
                else
                {
                    if (EnsureButtonClick != null)
                    {
                        AddrType  = Type.ToString();
                        StartAddr = uint.Parse(textBox.Text);
                        if ((bool)checkbox1.IsChecked)
                        {
                            IntrasegmentType = ElementAddressHelper.GetIntrasegmentAddrType(comboBox1.SelectedIndex).ToString();
                            IntrasegmentAddr = uint.Parse(textBox1.Text);
                        }
                        if (ElementAddressHelper.IsBitAddr(Type))
                        {
                            DataType = 0;
                        }
                        else
                        {
                            DataType = DataTypeCombox.SelectedIndex + 1;
                        }
                        if ((bool)checkbox.IsChecked)
                        {
                            AddNums = int.Parse(rangeTextBox.GetTextBox().Text);
                        }
                        else
                        {
                            AddNums = 1;
                        }
                        EnsureButtonClick.Invoke(this, new RoutedEventArgs());
                    }
                }
            }
            else
            {
                LocalizedMessageBox.Show(Properties.Resources.Address_Cross, LocalizedMessageIcon.Warning);
            }
        }
 private void OnEnsureButtonClick(object sender, RoutedEventArgs e)
 {
     FontManager.GetTitle().Setup(
         DemoFontManager.GetTitle());
     FontManager.GetComment().Setup(
         DemoFontManager.GetComment());
     FontManager.GetLadder().Setup(
         DemoFontManager.GetLadder());
     FontManager.GetFunc().Setup(
         DemoFontManager.GetFunc());
     EnsureButtonClick.Invoke(this, new RoutedEventArgs(ButtonBase.ClickEvent));
     Close();
 }
        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());
            }
        }
 private void OnEnsureButtonClick(object sender, RoutedEventArgs e)
 {
     EnsureButtonClick.Invoke(sender, e);
 }