예제 #1
0
		public override void OnInitialized (EventArgs e)
		{
			base.OnInitialized (e);
			var form = new MainForm(Configuration);
			this.MainForm = form;
			
			if (File.Exists (SettingsFileName)) {
				//JsonConvert.PopulateObject (File.ReadAllText(SettingsFileName), form);
				try {
					this.LoadXml (SettingsFileName);
				}
				catch (Exception ex) {
					// don't worry about not loading
					Debug.WriteLine ("Error loading settings: {0}", ex);
				}
			}
			form.Initialize();
			this.BadgeLabel = null;
			this.MainForm.Show ();
			
			foreach (var server in Configuration.Servers) {
				if (server.ConnectOnStartup)
					server.Connect ();
			}
			
			if (!Configuration.Servers.Any ()) {
				Application.Instance.AsyncInvoke (delegate {
					var action = new Actions.AddServer {
						AutoConnect = true
					};
					action.Activate ();
				});
			}
			
		}
예제 #2
0
 public override void OnInitialized(EventArgs e)
 {
     base.OnInitialized(e);
     LoadSettings();
     var form = new MainForm(Configuration);
     this.MainForm = form;
     if (interfaceElement != null)
     {
         form.ReadXml(interfaceElement);
         interfaceElement = null;
     }
     
     form.Initialize();
     this.BadgeLabel = null;
     this.MainForm.Show();
     
     if (!Configuration.Servers.Any())
     {
         Application.Instance.AsyncInvoke(delegate
         {
             var action = new Actions.AddServer {
                 AutoConnect = true
             };
             action.Activate();
         });
     }
     else
     {
         foreach (var server in Configuration.Servers)
         {
             if (server.ConnectOnStartup)
                 server.Connect();
         }
     }
 }