/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } foreach (Protocol protocol in this.protocolList) { protocol.Disconnect(new OperationCompleteEvent()); protocol.Dispose(); } if (this.sysTrayIcon != null) { this.sysTrayIcon.Dispose(); } this.sysTrayIcon = null; if (this.taskbarNotify != null) { this.taskbarNotify.Dispose(); } this.taskbarNotify = null; } base.Dispose(disposing); }
/// <summary> /// Constructs a MainForm object. This is where most of the fun happens. /// </summary> /// <param name="mainStorage"></param> public MainForm(IStorage mainStorage) { this.mainStorage = mainStorage; // // Required for Windows Form Designer support // InitializeComponent(); this.MaximizeBox = false; // create sys tray icon System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm)); this.sysTrayIcon = new SysTrayIcon(this, (Drawing.Icon)resources.GetObject("$this.Icon")); // initialise task bar notifier this.taskbarNotify = new TaskbarNotifier(); this.taskbarNotify.SetBackgroundBitmap( Config.Constants.ImagePath + System.IO.Path.DirectorySeparatorChar + "skin.bmp", Drawing.Color.FromArgb(255, 0, 255)); this.taskbarNotify.TitleRectangle = new Drawing.Rectangle(70, 9, 70, 25); this.taskbarNotify.ContentRectangle = new Drawing.Rectangle(8, 41, 133, 68); this.taskbarNotify.NormalTitleColor = Drawing.Color.Red; this.taskbarNotify.NormalContentColor = Drawing.Color.DarkBlue; // load plugins (duh) LoadPlugins(); // hook contact tree events this.contactTreeView.DoubleClick += new EventHandler(OnContactTreeDoubleClick); this.UpdateOptions(); if (GlobalSettings.Instance().ConnectAllOnStartup) { this.ConnectAll(); } }