Пример #1
0
        private void llblRawEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (SetEditingNotifierHost())
            {
                RAWXmlEditor editor    = new RAWXmlEditor();
                string       oldMarkUp = editingNotifierHost.ToXml();
                editor.SelectedMarkup = oldMarkUp;
                if (editor.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        editingNotifierHost = NotifierHost.FromXml(editor.SelectedMarkup, null, false);

                        if (editor.SelectedMarkup == null || editor.SelectedMarkup.Length == 0)
                        {
                            if (MessageBox.Show("Editing the raw config resulted in a configuration error!\r\nDo you want to accept this?", "Configuration error", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.No)
                            {
                                editingNotifierHost = NotifierHost.FromXml(oldMarkUp, null, false);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("An error occured while processing the config!\r\n" + ex.Message, "Edit config", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    LoadControlData();
                }
            }
        }
Пример #2
0
 private void EditNotifierHost_Load(object sender, EventArgs e)
 {
     try
     {
         if (SelectedConfig != null && SelectedConfig.Length > 0 && SelectedConfig.StartsWith("<notifierHost", StringComparison.CurrentCultureIgnoreCase))
         {
             editingNotifierHost = NotifierHost.FromXml(SelectedConfig, null, false);
         }
         else
         {
             editingNotifierHost = new NotifierHost();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Loading error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }