예제 #1
0
        private void ShowSettings()
        {
            try
            {
                Settings settings = new Settings();

                if (notifySettings != null)
                {
                    settings.settingsRemoteMonServiceAddressTextBox.Text = notifySettings.ServiceAddress;
                    settings.settingsRemoteMonServicePortTextBox.Text = notifySettings.ServicePort.ToString();
                }
                DialogResult dr = settings.ShowDialog();

                if (dr == DialogResult.OK)
                {
                    if (notifySettings == null)
                        notifySettings = new NotifySettings();
                    notifySettings.ServiceAddress = settings.settingsRemoteMonServiceAddressTextBox.Text;
                    Int32 port;
                    if (Int32.TryParse(settings.settingsRemoteMonServicePortTextBox.Text, out port))
                        notifySettings.ServicePort = port;

                    if (Listener.IsLocal(notifySettings.ServiceAddress))
                        talker = new MessageQueueTalker(Namespace.Notifier);
                    else
                        talker = new TcpTalker(notifySettings.ServiceAddress, thisNamespace: Namespace.Notifier);

                    notifySettings.ExportToXml("settings.xml");
                }
            }
            catch(Exception ex)
            {
                Logger.Instance.LogException(this.GetType(), ex);
            }
        }
예제 #2
0
 public XmlExport(string fileName, NotifySettings data)
 {
     _fileName = fileName;
     _data = data;
 }
예제 #3
0
 private void LoadSettings()
 {
     try
     {
         notifySettings = NotifySettings.LoadSettings("settings.xml");
         if (notifySettings != null)
         {
             if (Listener.IsLocal(notifySettings.ServiceAddress))
                 talker = new MessageQueueTalker(Namespace.Notifier);
             else
                 talker = new TcpTalker(notifySettings.ServiceAddress, thisNamespace: Namespace.Notifier);
         }
     }
     catch(Exception ex)
     {
         Logger.Instance.LogException(this.GetType(), ex);
     }
 }