示例#1
0
 public MxApplicationWindow(IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
     IServiceContainer service = (IServiceContainer) this.GetService(typeof(IServiceContainer));
     if (service != null)
     {
         this._uiService = new UIService(base.ServiceProvider, this);
         service.AddService(typeof(IMxUIService), this._uiService);
         service.AddService(typeof(IUIService), this._uiService);
         this.Font = this._uiService.UIFont;
     }
     IApplicationIdentity identity = (IApplicationIdentity) this.GetService(typeof(IApplicationIdentity));
     if (identity != null)
     {
         try
         {
             string setting = identity.GetSetting("WindowMaximized");
             if ((setting != null) && setting.Equals("true"))
             {
                 base.WindowState = FormWindowState.Maximized;
             }
             else
             {
                 base.WindowState = FormWindowState.Normal;
             }
             string str2 = identity.GetSetting("WindowLeft", false);
             if ((str2 != null) && (str2.Length != 0))
             {
                 int x = Convert.ToInt32(str2);
                 int y = Convert.ToInt32(identity.GetSetting("WindowTop", false));
                 int width = Convert.ToInt32(identity.GetSetting("WindowWidth", false));
                 int height = Convert.ToInt32(identity.GetSetting("WindowHeight", false));
                 base.Bounds = new Rectangle(x, y, width, height);
             }
             else
             {
                 base.Bounds = Screen.FromPoint(Cursor.Position).WorkingArea;
             }
             base.StartPosition = FormStartPosition.Manual;
         }
         catch (Exception)
         {
         }
     }
     this.AllowDrop = true;
 }
示例#2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         IServiceContainer service = (IServiceContainer) this.GetService(typeof(IServiceContainer));
         if (service != null)
         {
             service.RemoveService(typeof(IUIService));
         }
         if (this._uiService != null)
         {
             ((IDisposable) this._uiService).Dispose();
             this._uiService = null;
         }
     }
     base.Dispose(disposing);
 }