/// <summary> /// Focus the single control, when it is the only one on the specified page. /// </summary> /// <param name="page">The page.</param> /// <remarks>Documented by Dev02, 2008-04-23</remarks> private void FocusSingleControl(MultiPanePage page) { if (page != null && page.Controls.Count == 1) { page.Controls[0].Focus(); } }
private void InitializeAjouterTransactionBudgetDuMois( MultiPanePage callingPage, DateTime dataTransac, string description, string montant, bool recette, bool percu, int type) { // call base this.InitializeAjouterTransactionBudgetDuMois(); // Paramètres des composants panelAjoutTransac.Visible = false; this.Text = "Modifier une transaction"; this.btnAjoutTransaction_Annuler2.Visible = true; this.btnAjoutTransaction_modif.Visible = true; this.btnAjoutTransaction_modif.Enabled = true; // Initialisation de la transaction à modifier // Récupération des info de la transaction du formulaire père this.calAjoutTransaction.Value = dataTransac; this.txtAjoutTransaction_desc.Text = description; this.txtAjoutTransaction_montant.Text = montant; this.ckbAjoutTransaction_recette.Checked = recette; this.ckbAjoutTransaction_percu.Checked = percu; this.ajoutTransaction_typeTransac = type; // hide sidebar this.HideSidebar(); this.FrmAjoutTransaction_Load(); }
// Change the form's current page private void SwitchPanel(MultiPanePage target) { this.ContentPanel.SelectedPage = target; // unfocus the active control this.ActiveControl = null; }
public object CreateControlWithOnePage(IDesignerHost theHost, object theParam) { MultiPaneControl control = (MultiPaneControl)theHost.CreateComponent(typeof(MultiPaneControl)); MultiPanePage page = (MultiPanePage)theHost.CreateComponent(typeof(MultiPanePage)); control.Controls.Add(page); return(new IComponent[] { control }); }
private void Handler_SelectedPageChanged(object theSender, EventArgs theArgs) { mySelectedPage = DesignedControl.SelectedPage; // We do not call the property here, because the control // has already updated pages' visibility. We only must // sync the field with the control's current selection }
private object Transaction_UpdateSelectedPage(IDesignerHost theHost, object theParam) { MultiPaneControl aCtl = DesignedControl; MultiPanePage aPgTemp = mySelectedPage; int aCurIndex = aCtl.Controls.IndexOf(mySelectedPage); if (mySelectedPage == aCtl.SelectedPage) //we also need to update the SelectedPage property { MemberDescriptor aMember_SelectedPage = TypeDescriptor.GetProperties(aCtl)["SelectedPage"]; RaiseComponentChanging(aMember_SelectedPage); if (aCtl.Controls.Count > 1) { // begin update current page if (aCurIndex == aCtl.Controls.Count - 1) // NOTE: after SelectedPage has { aCtl.SelectedPage = (MultiPanePage)aCtl.Controls[aCurIndex - 1]; // been updated, mySelectedPage } else // has also changed { aCtl.SelectedPage = (MultiPanePage)aCtl.Controls[aCurIndex + 1]; } // end update current page } else { aCtl.SelectedPage = null; } RaiseComponentChanged(aMember_SelectedPage, null, null); } else { if (aCtl.Controls.Count > 1) { if (aCurIndex == aCtl.Controls.Count - 1) { DesignerSelectedPage = (MultiPanePage)aCtl.Controls[aCurIndex - 1]; } else { DesignerSelectedPage = (MultiPanePage)aCtl.Controls[aCurIndex + 1]; } } else { DesignerSelectedPage = null; } } return(null); }
private object Transaction_AddPage(IDesignerHost theHost, object theParam) { MultiPaneControl designedControl = this.DesignedControl; MultiPanePage page = (MultiPanePage)theHost.CreateComponent(typeof(MultiPanePage)); MemberDescriptor member = TypeDescriptor.GetProperties(designedControl)["Controls"]; base.RaiseComponentChanging(member); designedControl.Controls.Add(page); this.DesignerSelectedPage = page; base.RaiseComponentChanged(member, null, null); return(null); }
protected void DrawBorder(Graphics theG) { MultiPanePage designedControl = this.DesignedControl; if ((designedControl != null) && designedControl.Visible) { Rectangle clientRectangle = designedControl.ClientRectangle; clientRectangle.Width--; clientRectangle.Height--; theG.DrawRectangle(this.BorderPen, clientRectangle); } }
public object CreateControlWithOnePage(IDesignerHost theHost, object theParam) { // Control MultiPaneControl aCtl = (MultiPaneControl)theHost.CreateComponent(typeof(MultiPaneControl)); // Page 1 MultiPanePage aPg = (MultiPanePage)theHost.CreateComponent(typeof(MultiPanePage)); aCtl.Controls.Add(aPg); return(new IComponent[] { aCtl }); }
private object Transaction_AddPage(IDesignerHost theHost, object theParam) { MultiPaneControl aCtl = DesignedControl; MultiPanePage aNewPage = (MultiPanePage)theHost.CreateComponent(typeof(MultiPanePage)); MemberDescriptor aMem_Controls = TypeDescriptor.GetProperties(aCtl)["Controls"]; RaiseComponentChanging(aMem_Controls); aCtl.Controls.Add(aNewPage); DesignerSelectedPage = aNewPage; RaiseComponentChanged(aMem_Controls, null, null); return(null); }
private MultiPanePageDesigner GetSelectedPageDesigner() { MultiPanePage mySelectedPage = this.mySelectedPage; if (mySelectedPage == null) { return(null); } MultiPanePageDesigner designer = null; IDesignerHost service = (IDesignerHost)this.GetService(typeof(IDesignerHost)); if (service != null) { designer = (MultiPanePageDesigner)service.GetDesigner(mySelectedPage); } return(designer); }
private object Transaction_UpdateSelectedPage(IDesignerHost theHost, object theParam) { MultiPaneControl designedControl = this.DesignedControl; MultiPanePage mySelectedPage = this.mySelectedPage; int index = designedControl.Controls.IndexOf(this.mySelectedPage); if (this.mySelectedPage == designedControl.SelectedPage) { MemberDescriptor member = TypeDescriptor.GetProperties(designedControl)["SelectedPage"]; base.RaiseComponentChanging(member); if (designedControl.Controls.Count > 1) { if (index == (designedControl.Controls.Count - 1)) { designedControl.SelectedPage = (MultiPanePage)designedControl.Controls[index - 1]; } else { designedControl.SelectedPage = (MultiPanePage)designedControl.Controls[index + 1]; } } else { designedControl.SelectedPage = null; } base.RaiseComponentChanged(member, null, null); } else if (designedControl.Controls.Count > 1) { if (index == (designedControl.Controls.Count - 1)) { this.DesignerSelectedPage = (MultiPanePage)designedControl.Controls[index - 1]; } else { this.DesignerSelectedPage = (MultiPanePage)designedControl.Controls[index + 1]; } } else { this.DesignerSelectedPage = null; } return(null); }
private void Handler_SelectionChanged(object sender, EventArgs e) { ISelectionService service = (ISelectionService)this.GetService(typeof(ISelectionService)); if (service != null) { ICollection selectedComponents = service.GetSelectedComponents(); MultiPaneControl designedControl = this.DesignedControl; foreach (object obj2 in selectedComponents) { MultiPanePage pageOfControl = GetPageOfControl(obj2); if ((pageOfControl != null) && (pageOfControl.Parent == designedControl)) { this.DesignerSelectedPage = pageOfControl; break; } } } }
private MultiPanePageDesigner GetSelectedPageDesigner() { MultiPanePage aSelPage = mySelectedPage; if (aSelPage == null) { return(null); } MultiPanePageDesigner aDesigner = null; IDesignerHost aSrv = (IDesignerHost)GetService(typeof(IDesignerHost)); if (aSrv != null) { aDesigner = (MultiPanePageDesigner)aSrv.GetDesigner(aSelPage); } return(aDesigner); }
protected void DrawBorder(Graphics theG) { MultiPanePage aCtl = DesignedControl; if (aCtl == null) { return; } else if (!aCtl.Visible) { return; } Rectangle aRct = aCtl.ClientRectangle; aRct.Width--; // decrement the with so that the bottom and aRct.Height--; // right lines could be visible theG.DrawRectangle(BorderPen, aRct); }
private void Handler_SelectionChanged(object sender, EventArgs e) { ISelectionService aSrv = (ISelectionService)GetService(typeof(ISelectionService)); if (aSrv == null) { return; } ICollection aSel = aSrv.GetSelectedComponents(); MultiPaneControl aCtl = DesignedControl; foreach (object aIt in aSel) { MultiPanePage aPage = GetPageOfControl(aIt); if ((aPage != null) && (aPage.Parent == aCtl)) { DesignerSelectedPage = aPage; break; } } }
private void Handler_ComponentRemoving(object theSender, ComponentEventArgs theArgs) { if (theArgs.Component is MultiPanePage) { MultiPaneControl designedControl = this.DesignedControl; MultiPanePage component = (MultiPanePage)theArgs.Component; if (designedControl.Controls.Contains(component)) { IDesignerHost service = (IDesignerHost)this.GetService(typeof(IDesignerHost)); if (!this.myInTransaction) { this.myInTransaction = true; DesignerTransactionUtility.DoInTransaction(service, "MultiPaneControlRemoveComponent", new TransactionAwareParammedMethod(this.Transaction_UpdateSelectedPage), null); this.myInTransaction = false; } else { this.Transaction_UpdateSelectedPage(service, null); } this.CheckVerbStatus(); } } }
private void Handler_ComponentRemoving(object theSender, ComponentEventArgs theArgs) { if (!(theArgs.Component is MultiPanePage)) { return; } MultiPaneControl aCtl = DesignedControl; MultiPanePage aPg = (MultiPanePage)theArgs.Component; if (!aCtl.Controls.Contains(aPg)) { return; } IDesignerHost aHost = (IDesignerHost)GetService(typeof(IDesignerHost)); if (!myInTransaction) { myInTransaction = true; DesignerTransactionUtility.DoInTransaction ( aHost, "MultiPaneControlRemoveComponent", new TransactionAwareParammedMethod(Transaction_UpdateSelectedPage), null ); myInTransaction = false; } else { Transaction_UpdateSelectedPage(aHost, null); } CheckVerbStatus(); }
public SidebarEntry(MultiPanePage target, byte[] icon, string text, SidebarEntry[] children) : this(target, icon, text) { this.children = children; }
public SidebarEntry(MultiPanePage target, byte[] icon, string text) : this(target, text) { this.Icon = icon; }
public SidebarEntry(MultiPanePage target, string text) : this(text) { this.Target = target; }
public MultiPanePageItem(MultiPanePage thePg) { myPage = thePg; }
private void Handler_OK(object sender, EventArgs e) { myFutureSelectedItem = ((MultiPanePageItem)myCtlCmbItems.SelectedItem).Page; mySetSelectedPage = myCtlChkSetSelectedPage.Checked; }
public SidebarEntry(MultiPanePage target, CallbackFunction callback, byte[] icon, string text, SidebarEntry[] children) : this(target, icon, text) { this.children = children; this.TargetCallback = callback; }
private void Handler_SelectedPageChanged(object theSender, EventArgs theArgs) { this.mySelectedPage = this.DesignedControl.SelectedPage; }
public FrmMain() { // set the base name (used later to rename the form) this.BaseName = "Breaking Aurum"; InitializeComponent(); // set the form's style manager to the control `metroStyleManager` // it will allow to propagate the theme selection this.StyleManager = this.metroStyleManager; // Create the fonts icons collection & set the default one (MaterialIcons) this.IconFontManager = (new IconFonts()); this.IconFont = this.IconFontManager.GetFont(IconFonts.FONT_FAMILY.MaterialIcons, 17.0f); // set the default page and switch to it this.DefaultPage = this.HomePage; this.Font = new Font("Arial", 11f, FontStyle.Regular, GraphicsUnit.Pixel); // ---- // Load the user's preferences LoadSettings(); // Load the LocalizationManager that will provide the localization system Program.settings.localize.ImportResourceLocalization(this.Name); // load the form's localization data Program.settings.localize.ImportResourceLocalization("Sidebar"); // load the sidebar's localization data // try to localize every sub-control Program.settings.localize.ControlerTranslator(this); // create the sidebar's top entries this.TopSidebarEntries = new SidebarEntry[] { // (To have a parent that do nothing: pass as first parameter: `(MultiPanePage)null`) new SidebarEntry(this.HomePage, new byte[] { 0xEE, 0xA2, 0x8A }, // little "house" icon Program.settings.localize.Translate("sidebar_page_home")), new SidebarEntry( target: this.PageDashboard, callback: () => this.UpdateDashboard(), icon: new byte[] { 0xEE, 0xA1, 0xB1 }, // a grid icon text: Program.settings.localize.Translate("sidebar_page_dashboard"), children: null ), new SidebarEntry(() => (new FrmCalendrierPrev()).ShowDialog(), new byte[] { 0xEE, 0xA4, 0x96 }, // a timetable icon Program.settings.localize.Translate("sidebar_page_calendrier_previsionnel")), // budget previsonnel new SidebarEntry((MultiPanePage)null, new byte[] { 0xEE, 0xA2, 0xA1 }, // credit card icon Program.settings.localize.Translate("sidebar_page_budget_previsionnel"), new SidebarEntry[] { new SidebarEntry(this.PagePostesFixes, Program.settings.localize.Translate("sidebar_page_poste_fixe")), new SidebarEntry(this.PagePostesPonctuel, Program.settings.localize.Translate("sidebar_page_poste_ponctuel")), new SidebarEntry(this.PageRevenus, Program.settings.localize.Translate("sidebar_page_revenu")), new SidebarEntry(() => (new FrmTableauDeBordPostes()).ShowDialog(), Program.settings.localize.Translate("sidebar_page_lister_postes")), } ), // budget du mois new SidebarEntry((MultiPanePage)null, new byte[] { 0xEE, 0xA1, 0xAC }, // "validate/ check" icon Program.settings.localize.Translate("sidebar_page_budget_mois"), new SidebarEntry[] { new SidebarEntry( () => { (new AjouterTransaction()).ShowDialog(); this.UpdateDashboard(); }, Program.settings.localize.Translate("sidebar_page_ajouter_transaction") ), new SidebarEntry( () => (new FrmAffichage1par1()).ShowDialog(), Program.settings.localize.Translate("sidebar_page_lister_transactions") ), new SidebarEntry( () => (new TransactionsToPDF()).ShowDialog(), Program.settings.localize.Translate("sidebar_page_exporter_transactions") ), }), }; // create the sidebar's bottom entries this.BottomSidebarEntries = new SidebarEntry[] { new SidebarEntry(this.SettingsPage, new byte[] { 0xEE, 0xA1, 0xA9 }, // gear icon Program.settings.localize.Translate("sidebar_page_settings")), new SidebarEntry(this.LicensesPage, new byte[] { 0xEE, 0x90, 0xA0 }, // smiling icon Program.settings.localize.Translate("sidebar_page_licenses")) }; // initialize sub panels InitializePostesFixes(); InitializePostesPonctuels(echancesContainer); InitiliazePosteRevenu(); InitiliazeSettingsPage(); }