Exemplo n.º 1
0
        /// <summary>
        /// Creates an instance of child form of given form type
        /// </summary>
        /// <param name="formType">type of form to be created, for example SettingsXtraForm</param>
        /// <returns>reference to newly created child form</returns>
        private ChildForm CreateChildForm(Type formType, List <KeyValuePair <string, object> > parameters)
        {
            ChildForm newlyCreatedForm = null;

            if (FramesCanOpen < 1)
            {
                notify.HideProcessing();
                notify.ShowError(Program.LanguageManager.GetString(StringResources.Message_NoMoreDocumentsCanOpen),
                                 Program.LanguageManager.GetString(StringResources.Message_ErrorHeader));
            }
            else
            {
                if (parameters != null)
                {
                    newlyCreatedForm = (ChildForm)Program.Kernel.Get(formType,
                                                                     parameters.Select(kvp => new ConstructorArgument(kvp.Key, kvp.Value)).ToArray());
                }
                else
                {
                    newlyCreatedForm = (ChildForm)Program.Kernel.Get(formType);
                }

                childForms[formType.Name].Add(newlyCreatedForm);
                newlyCreatedForm.MdiParent   = Program.MainForm;
                newlyCreatedForm.FormClosed += ChildClosedEventHandler;
                FramesCanOpen--;
            }

            return(newlyCreatedForm);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create and show Settings child form. Starting tab page is set or first page if page doesn't exist.
        /// </summary>
        /// <param name="page">number of starting page</param>
        public void OpenSettingsChildForm(int page)
        {
            try
            {
                Prizm.Main.Forms.Settings.SettingsXtraForm form = (Prizm.Main.Forms.Settings.SettingsXtraForm)OpenReturnChildForm(DocumentTypes.Settings, null);

                if (form != null && form.tabbedControlGroup.TabPages.Count > page)
                {
                    form.tabbedControlGroup.SelectedTabPage = form.tabbedControlGroup.TabPages[page];
                }
            }
            finally
            {
                notify.HideProcessing();
            }
        }