/// <summary> /// Creates a panel that needs to be displayed. /// </summary> /// <param name="panel">The panel to create</param> private void CreatePanel(AvailablePanels panel) { switch (panel) { case (AvailablePanels.Controls): this.mControlsPanel = new ControlsPanel(); this.mControlsPanel.ev_OptionSelected += new ControlsPanel.OptionSelected(ControlsPanel_ev_OptionSelected); this.Controls.Add(this.mControlsPanel); break; case (AvailablePanels.Size): this.mSizePanel = new SizePanel(this.mWallpaperSize); this.mSizePanel.ev_EventFired += new EventFired(SizePanel_ev_EventFired); this.Controls.Add(this.mSizePanel); break; case (AvailablePanels.Tags): this.mTagsPanel = new TagsPanel(this.mTags); this.mTagsPanel.ev_EventFired += new EventFired(TagsPanel_ev_EventFired); this.Controls.Add(this.mTagsPanel); break; case (AvailablePanels.Source): this.mSourcePanel = new SourcePanel(this.mUserName,this.mEncryptedToken,this.mPasswordKey,this.mPasswordIV); this.mSourcePanel.ev_EventFired += new EventFired(SourcePanel_ev_EventFired); this.Controls.Add(this.mSourcePanel); break; case (AvailablePanels.Changer): this.mChangerPanel = new ChangerPanel(this.mAutoRun, this.mRunBefore); this.mChangerPanel.ev_EventFired += new EventFired(ChangerPanel_ev_EventFired); this.Controls.Add(this.mChangerPanel); break; case (AvailablePanels.Timings): this.mTimingsPanel = new TimingsPanel(this.mPictureChangeInterval, this.mReindexTime); this.mTimingsPanel.ev_EventFired += new EventFired(TimingsPanel_ev_EventFired); this.Controls.Add(this.mTimingsPanel); break; } }
/// <summary> /// Disposes of an open control panel /// </summary> /// <param name="panel">The panel type being disposed</param> private void RemovePanel(AvailablePanels panel) { switch (panel) { case (AvailablePanels.Controls): if (this.mControlsPanel != null) { this.mControlsPanel.ev_OptionSelected -= ControlsPanel_ev_OptionSelected; this.mControlsPanel.Dispose(); this.mControlsPanel = null; } break; case (AvailablePanels.Size): if (this.mSizePanel != null) { this.mSizePanel.ev_EventFired -= SizePanel_ev_EventFired; this.mSizePanel.Dispose(); this.mSizePanel = null; } break; case (AvailablePanels.Tags): if (this.mTagsPanel != null) { this.mTagsPanel.ev_EventFired -= TagsPanel_ev_EventFired; this.mTagsPanel.Dispose(); this.mTagsPanel = null; } break; case (AvailablePanels.Source): if (this.mSourcePanel != null) { this.mSourcePanel.ev_EventFired -= SourcePanel_ev_EventFired; this.mSourcePanel.Dispose(); this.mSourcePanel = null; } break; case (AvailablePanels.Changer): if (this.mChangerPanel != null) { this.mChangerPanel.ev_EventFired -= ChangerPanel_ev_EventFired; this.mChangerPanel.Dispose(); this.mChangerPanel = null; } break; case (AvailablePanels.Timings): if (this.mTimingsPanel != null) { this.mTimingsPanel.ev_EventFired -= TimingsPanel_ev_EventFired; this.mTimingsPanel.Dispose(); this.mTimingsPanel = null; } break; case (AvailablePanels.Wizard_Start): if (this.mNewPanel != null) { this.mNewPanel.Dispose(); this.mNewPanel = null; } break; } }