Changeset 1490


Ignore:
Timestamp:
1/9/2010 8:39:36 AM (5 years ago)
Author:
lowjoel
Message:

Changed the implement of the "page" concept - the old method used the removal and addition of pages to one panel; this caused disruptions in the window hierarchy (which causes NullReferenceExceptions? e.g. in SchedulerPanel?.cs: SchedulerPanel?.task_TaskFinished) The new design adds all pages at the start, and hides and displays pages when switched to them, also ensuring correct focus by using the z-order of Controls.

As such, UXThemeApi.UpdateControlTheme?(this) needn't be called by the SchedulerPanel? nor the SettingsPanel? class since they're now children of MainForm?. Fixes NullReferenceException? experienced by users who use the context menu to erase files/folders.

Location:
branches/eraser6/6.0/Eraser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser/MainForm.cs

    r1429 r1490  
    4646        { 
    4747            InitializeComponent(); 
     48            contentPanel.Controls.Add(SchedulerPage); 
     49            contentPanel.Controls.Add(SettingsPage); 
     50            CreateControl(); 
     51 
    4852            UXThemeApi.UpdateControlTheme(this); 
    4953            UXThemeApi.UpdateControlTheme(notificationMenu); 
    50  
    51             CreateControl(); 
    52             SettingsPage.CreateControl(); 
    53             SchedulerPage.CreateControl(); 
    5454 
    5555            //Connect to the executor task processing and processed events. 
     
    6262            //Set the docking style for each of the pages 
    6363            SchedulerPage.Dock = DockStyle.Fill; 
     64            SettingsPage.Visible = false; 
    6465 
    6566            //Show the default page. 
     
    102103            { 
    103104                contentPanel.SuspendLayout(); 
    104                 contentPanel.Controls.Remove(oldPage); 
    105                 contentPanel.Controls.Add(CurrPage); 
    106  
     105 
     106                //Hide the old page before showing the new one 
     107                if (oldPage != null) 
     108                    oldPage.Visible = false; 
     109 
     110                //If the page is not set to dock, we need to specify the dimensions of the page 
     111                //so it fits properly. 
    107112                if (CurrPage.Dock == DockStyle.None) 
    108113                { 
     
    113118                    CurrPage.Width = contentPanel.Width; 
    114119                } 
     120 
     121                //Show the new page then bring it to the top of the z-order. 
     122                CurrPage.Visible = true; 
     123                CurrPage.BringToFront(); 
    115124                contentPanel.ResumeLayout(); 
    116125            } 
  • branches/eraser6/6.0/Eraser/SchedulerPanel.cs

    r1360 r1490  
    4343        { 
    4444            InitializeComponent(); 
    45             UXThemeApi.UpdateControlTheme(this); 
    4645            UXThemeApi.UpdateControlTheme(schedulerDefaultMenu); 
    4746 
     
    254253            //Show a balloon to inform the user 
    255254            MainForm parent = (MainForm)FindForm(); 
    256             if (parent != null && parent.WindowState == FormWindowState.Minimized || !parent.Visible) 
     255 
     256            //TODO: Is this still needed? 
     257            if (parent == null) 
     258                throw new InvalidOperationException(); 
     259            if (parent.WindowState == FormWindowState.Minimized || !parent.Visible) 
    257260            { 
    258261                string message = null; 
  • branches/eraser6/6.0/Eraser/SettingsPanel.cs

    r1482 r1490  
    4343        { 
    4444            InitializeComponent(); 
    45             UXThemeApi.UpdateControlTheme(this); 
    4645 
    4746            //For new plugins, register the callback. 
Note: See TracChangeset for help on using the changeset viewer.