public void LoadViewControl(ViewControlBase viewControl) { connectionError = false; ShowCommonTasks(Properties.Settings.Default.DisplayCommonTasks, false); // Save the data from our current view control if (currentViewControl != null) { lblLoadStatus.Text = CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.MainForm_SavingChanges); lblLoadStatus.Visible = true; if (!currentViewControl.SaveData()) { return; } lblLoadStatus.Text = CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.MainForm_ChangesSaved); currentViewControl.Dispose(); currentViewControl = null; } lblLoadStatus.Text = CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.MainForm_LoadingData); if (!viewControl.LoadData()) { return; } currentViewControl = viewControl; // Remove the view from the screen pnlContent.Controls.Clear(); Utils.PrivateLabelUtils.ReplaceProductNameControl(viewControl); // Load the new control lblViewTitle.Text = viewControl.HeaderTitle; lblHeaderCaption.Text = viewControl.HeaderCaption; picHeaderIcon.Image = viewControl.HeaderIcon; lblLoadStatus.Visible = false; viewControl.Dock = DockStyle.Fill; pnlContent.Controls.Add(viewControl); viewControl.Show(); if (viewControl is SummaryView) { btnBackToSummary.Visible = false; } else { btnBackToSummary.Visible = true; } }
internal static ContentView RegisterControl(ViewControlBase control) { //-- #1: cast ErrorControl errorControl = null; FieldControl fieldControl = control as FieldControl; if (fieldControl == null) { errorControl = control as ErrorControl; } //-- #2: get ContentView Control parent = control.Parent; while (parent != null && !(parent is ContentView)) { parent = parent.Parent; } ContentView view = (parent as ContentView); //-- #3: there is not a ContentView in the parent axis: exception if (view == null) { if (fieldControl != null) { throw new ApplicationException(String.Concat("Control did not find the ContentView. Control type: ", control.GetType().FullName, ", Id: '", control.ID, "', FieldName: '", fieldControl.FieldName, "'")); } throw new ApplicationException(String.Concat("Control did not find the ContentView. Control type: ", control.GetType().FullName, ", Id: '", control.ID)); } //-- #4 finish if GenericFieldControl or others if (fieldControl == null && errorControl == null) { return(view); } //-- #5 register by type if (errorControl != null) { view.RegisterErrorControl(errorControl); } else { view.RegisterFieldControl(fieldControl); } //-- #6 introduce the view to caller return(view); }
private void ActivateControl(DevExpress.XtraTab.XtraTabPage page, ViewControlBase control) { if (page.Controls.Count == 0) { control.Dock = DockStyle.Fill; page.Controls.Add(control); } if (this.tcMain.SelectedTabPage != null) { UnsubscribeEvents((ViewControlBase)this.tcMain.SelectedTabPage.Controls[0]); ((ViewControlBase)this.tcMain.SelectedTabPage.Controls[0]).OnHideView(); } SubscribeEvents(control); control.OnShowView(); this.tcMain.SelectedTabPage = page; control.Focus(); }
void pluginButtonItem_Click(object sender, EventArgs e) { if (((global::Controls.LinkButton)sender).Tag is CallButler.Manager.Plugin.CallButlerManagementPlugin) { CallButler.Manager.Plugin.CallButlerManagementPluginViewControl pluginViewControl = ((CallButler.Manager.Plugin.CallButlerManagementPlugin)((global::Controls.LinkButton)sender).Tag).GetNewViewControl(); if (pluginViewControl != null) { ViewControlBase viewControl = new ViewControlBase(); pluginViewControl.Dock = DockStyle.Fill; viewControl.Controls.Add(pluginViewControl); pluginViewControl.BringToFront(); LoadViewControl(viewControl); } } }
public void ShowNoConnectionView() { connectionError = true; NoConnectionView ncView = new NoConnectionView(); currentViewControl = null; pnlContent.Controls.Clear(); lblViewTitle.Text = ncView.HeaderTitle; lblHeaderCaption.Text = ncView.HeaderCaption; picHeaderIcon.Image = ncView.HeaderIcon; ncView.Dock = DockStyle.Fill; pnlContent.Controls.Add(ncView); ncView.Show(); pnlExpired.Visible = false; pnlNewVersion.Visible = false; lblConnectionStatus.Text = CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.MainForm_NoConnection); }
private void UnsubscribeEvents(ViewControlBase control) { this.quickGalleryView.ItemClick -= control.OnQuickGalleryItemClick; }
internal static ContentView RegisterControl(ViewControlBase control) { //-- #1: cast ErrorControl errorControl = null; FieldControl fieldControl = control as FieldControl; if (fieldControl == null) errorControl = control as ErrorControl; //-- #2: get ContentView Control parent = control.Parent; while (parent != null && !(parent is ContentView)) parent = parent.Parent; ContentView view = (parent as ContentView); //-- #3: there is not a ContentView in the parent axis: exception if (view == null) { if (fieldControl != null) throw new ApplicationException(String.Concat("Control did not find the ContentView. Control type: ", control.GetType().FullName, ", Id: '", control.ID, "', FieldName: '", fieldControl.FieldName, "'")); throw new ApplicationException(String.Concat("Control did not find the ContentView. Control type: ", control.GetType().FullName, ", Id: '", control.ID)); } //-- #4 finish if GenericFieldControl or others if (fieldControl == null && errorControl == null) return view; //-- #5 register by type if (errorControl != null) view.RegisterErrorControl(errorControl); else view.RegisterFieldControl(fieldControl); //-- #6 introduce the view to caller return view; }