/// <summary>
        /// Handles a selection change event
        /// </summary>
        public virtual void SelectionChanged()
        {
            if (BaseTreeView.RefreshNodeContent)
            {
                IBaseForm baseForm = BaseForm;
                if (baseForm != null)
                {
                    if (baseForm.ExpressionTextBox != null)
                    {
                        if (Model.ExpressionText != null)
                        {
                            baseForm.ExpressionTextBox.Lines   = Utils.Utils.toStrings(Model.ExpressionText);
                            baseForm.ExpressionTextBox.Enabled = true;
                        }
                        else
                        {
                            baseForm.ExpressionTextBox.Text    = "";
                            baseForm.ExpressionTextBox.Enabled = false;
                        }

                        RefreshNode();
                    }

                    if (baseForm.CommentsTextBox != null)
                    {
                        if (Model is DataDictionary.ICommentable)
                        {
                            DataDictionary.ICommentable commentable = (DataDictionary.ICommentable)Model;

                            baseForm.CommentsTextBox.Lines   = Utils.Utils.toStrings(commentable.Comment);
                            baseForm.CommentsTextBox.Enabled = true;
                        }
                        else
                        {
                            baseForm.CommentsTextBox.Text    = "";
                            baseForm.CommentsTextBox.Enabled = false;
                        }

                        RefreshNode();
                    }

                    if (baseForm.MessagesTextBox != null)
                    {
                        baseForm.MessagesTextBox.Lines    = Utils.Utils.toStrings(Model.Messages);
                        baseForm.MessagesTextBox.ReadOnly = true;
                    }

                    if (baseForm.subTreeView != null)
                    {
                        baseForm.subTreeView.SetRoot(Model);
                    }

                    if (baseForm.ExplainTextBox != null)
                    {
                        baseForm.ExplainTextBox.SetModel(Model);
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ContextType"></param>
        /// <param name="MdiForm">Mdi form that with MenuApplication</param>
        public CreateAndShowManagerFormHelper(Type ContextType, IBaseForm ParentForm)
        {
            // Merto FrameWork not support MDI Application
            // if (!((Form)MdiForm).IsMdiContainer) throw new Exception("FormApplicationMdi must be MdiContainer");

            this.MdiForm     = MdiForm;
            this.ContextType = ContextType;
        }
        /// <summary>
        /// Handles a expression text change event
        /// </summary>
        /// <param name="text">the new text</param>
        public virtual void ExpressionTextChanged(string text)
        {
            IBaseForm baseForm = BaseForm;

            if (baseForm != null && baseForm.ExpressionTextBox != null)
            {
                Model.ExpressionText = baseForm.ExpressionTextBox.Text;
            }
        }
Exemple #4
0
 private void MapDialogKeys(IBaseForm form)
 {
     form.DialogKeys[WinForms.Keys.Up]       = new DialogKeyHandler(NavigatePrior);
     form.DialogKeys[WinForms.Keys.Down]     = new DialogKeyHandler(NavigateNext);
     form.DialogKeys[WinForms.Keys.PageUp]   = new DialogKeyHandler(NavigatePriorPage);
     form.DialogKeys[WinForms.Keys.PageDown] = new DialogKeyHandler(NavigateNextPage);
     form.DialogKeys[WinForms.Keys.Home | WinForms.Keys.Control] = new DialogKeyHandler(NavigateFirst);
     form.DialogKeys[WinForms.Keys.End | WinForms.Keys.Control]  = new DialogKeyHandler(NavigateLast);
     form.DialogKeys[WinForms.Keys.Escape] = new DialogKeyHandler(CancelForm);
 }
 /// <summary>
 /// 实例化
 /// </summary>
 protected PixivDownBase(IBaseForm b, bool IsSingle)
 {
     this.MyForm      = b;
     this.IsSumThread = false;
     this.GetTypeStr  = "";
     this.Mut         = null;
     this.MainThread  = null;
     this.IsSingle    = IsSingle;
     this.count       = 0;
     this.Sleep       = 0;
 }
Exemple #6
0
 /// <summary>
 /// 初始化
 /// </summary>
 public PixivDownHelp(IBaseForm b, Form f, bool isSingle)
 {
     InitControl(b, f);
     this.form = b;
     //this.form = new BaseForm();//这个不行
     this.isSumThread = false;
     this.getType     = "";
     this.mut         = null;
     this.mainThread  = null;
     this.isSingle    = isSingle;
     this.count       = 0;
     this.Sleep       = 0;
 }
 /// <summary>
 /// 保存画师信息
 /// </summary>
 public static void SavePainterInfo(IBaseForm from)
 {
     if (from.RadSingle.Checked)
     {
         XmlHelp.SetXmlNode("Config:PixivSingleForm:Painter"
                            , new Dictionary <string, string>()
         {
             { "ID", from.DdlListUrl.Text },
             { "SavePath", from.TxtSavePath.Text }
         }
                            , "ID");
     }
 }
Exemple #8
0
        /// <summary>
        ///     Provides the base tree node associated to a model element
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        protected virtual BaseTreeNode CorrespondingNode(IModelElement model)
        {
            BaseTreeNode retVal = null;

            IBaseForm baseForm = GuiUtils.EnclosingFinder <IBaseForm> .Find(this);

            if (baseForm != null && baseForm.TreeView != null)
            {
                retVal = baseForm.TreeView.FindNode(model, true);
            }

            return(retVal);
        }
        /// <summary>
        /// Handles a comment text change event
        /// </summary>
        /// <param name="text">the new text</param>
        public virtual void CommentTextChanged(string text)
        {
            IBaseForm baseForm = BaseForm;

            if (baseForm != null && baseForm.ExpressionTextBox != null)
            {
                if (Model is DataDictionary.ICommentable)
                {
                    DataDictionary.ICommentable commentable = (DataDictionary.ICommentable)Model;

                    commentable.Comment = baseForm.CommentsTextBox.Text;
                }
            }
        }
Exemple #10
0
        public void Dispose()
        {
            var d = System.Threading.Interlocked.Exchange(ref _data, null);

            if (d != null)
            {
                d.changed -= DataChanged;
                if (_cl != null)
                {
                    _cl.PropertyChanged -= ClientChanged;
                }
                _contentForm.Dispose();
                _contentForm = null;
            }
        }
Exemple #11
0
        private void InitControl(IBaseForm b, Form f)
        {
            var type = typeof(IBaseForm);
            var ps   = type.GetProperties();

            foreach (var p in ps)
            {
                var name = p.Name[0].ToString().ToLower() + p.Name.Substring(1);
                var cs   = f.Controls.Find(name, false);
                if (cs.Length > 0)
                {
                    p.SetValue(b, cs[0]);
                }
            }
        }
Exemple #12
0
        private void DisposeBaseForm(IBaseForm form)
        {
            if (null == form)
            {
                return;
            }
            List <IBaseManager> mgrs = form.getManagers();

            if (null != mgrs)
            {
                foreach (IBaseManager mgr in mgrs)
                {
                    if (null != mgr)
                    {
                        mgr.close();
                    }
                }
            }
        }
        /// <summary>
        /// 加载页面的配置信息
        /// </summary>
        public static void LoadXmlConfig(IBaseForm from)
        {
            if (XmlHelp.doc == null)
            {
                XmlHelp.InitXmlDoucument();
            }

            try
            {
                from.DdlListUrl.Items.Clear();
                var users = XmlHelp.GetXmlNodesByPath("Config:PixivSingleForm:Painter");
                foreach (XmlNode n in users)
                {
                    from.DdlListUrl.Items.Add(n.SelectSingleNode("ID").InnerText);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Handles a selection change event
        /// </summary>
        public override void SelectionChanged()
        {
            base.SelectionChanged();

            if (BaseTreeView.RefreshNodeContent)
            {
                IBaseForm baseForm = BaseForm;
                if (baseForm != null)
                {
                    if (baseForm.Properties != null)
                    {
                        Editor editor = createEditor();
                        editor.Item = Item;
                        editor.Node = this;
                        baseForm.Properties.SelectedObject = editor;
                    }
                }
            }
            if (BaseForm is GUI.DataDictionaryView.Window)
            {
                (BaseForm as GUI.DataDictionaryView.Window).toolStripStatusLabel.Text = "";
            }
        }
Exemple #15
0
        private void SetForm(IBaseForm form)
        {
            if (_form != form)
            {
                if (_form != null)
                {
                    _form.Accepting                   -= new EventHandler(FormAccepting);
                    _form.Closing                     -= new CancelEventHandler(FormClosing);
                    _form.Closed                      -= new EventHandler(FormClosed);
                    _form.PaintBackground             -= new PaintHandledEventHandler(FormPaintBackground);
                    _form.LayoutContents              -= new EventHandler(FormLayoutContents);
                    _form.GetNaturalSize              -= new GetSizeHandler(FormGetNaturalSize);
                    _form.DefaultAction               -= new EventHandler(FormDefaultAction);
                    _form.Shown                       -= new EventHandler(FormShown);
                    _form.GetDefaultActionDescription -= new GetStringHandler(FormGetDefaultActionDescription);

                    ((Session)HostNode.Session).UnregisterControlHelp((WinForms.Control)_form);
                }
                _form = form;
                if (_form != null)
                {
                    _form.Accepting                   += new EventHandler(FormAccepting);
                    _form.Closing                     += new CancelEventHandler(FormClosing);
                    _form.Closed                      += new EventHandler(FormClosed);
                    _form.PaintBackground             += new PaintHandledEventHandler(FormPaintBackground);
                    _form.LayoutContents              += new EventHandler(FormLayoutContents);
                    _form.GetNaturalSize              += new GetSizeHandler(FormGetNaturalSize);
                    _form.DefaultAction               += new EventHandler(FormDefaultAction);
                    _form.Shown                       += new EventHandler(FormShown);
                    _form.GetDefaultActionDescription += new GetStringHandler(FormGetDefaultActionDescription);

                    _form.HelpButton = ((Session)HostNode.Session).IsContextHelpAvailable();
                    ((Session)HostNode.Session).RegisterControlHelp((WinForms.Control)_form, this);
                    MapDialogKeys(_form);
                }
            }
        }
 public AllFollow(IBaseForm b, bool IsSingle) : base(b, IsSingle)
 {
 }
 public Single(IBaseForm b, bool IsSingle) : base(b, IsSingle)
 {
 }
 public AllFollowFactory(IBaseForm b, bool IsSingle)
 {
     _object = new AllFollow(b, IsSingle);
 }
 public AuthorCollectionFactory(IBaseForm b, bool IsSingle)
 {
     _object = new AuthorCollection(b, IsSingle);
 }
 public PixivDownBase Create(IBaseForm b, bool IsSingle)
 {
     return(new Search(b, IsSingle));
 }
 public PixivDownBase Create(IBaseForm b, bool IsSingle)
 {
     return(new AuthorCollection(b, IsSingle));
 }
 public PixivDownBase Create(IBaseForm b, bool IsSingle)
 {
     return(new AllFollow(b, IsSingle));
 }
 public SingleFactory(IBaseForm b, bool IsSingle)
 {
     _object = new Single(b, IsSingle);
 }
 public SearchFactory(IBaseForm b, bool IsSingle)
 {
     _object = new Search(b, IsSingle);
 }
 public Collection(IBaseForm b, bool IsSingle) : base(b, IsSingle)
 {
 }
 public Math(IBaseForm form)
 {
     _form = form;
     // and then you can use call methods
     _form.SomeMethod1();
 }
Exemple #27
0
 public void Start(IBaseForm form)
 {
     ServiceForms.ShowForm(form);
 }
 public Search(IBaseForm b, bool IsSingle) : base(b, IsSingle)
 {
 }
Exemple #29
0
        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Open ERTMS Formal Spec file";
            openFileDialog.Filter = "EFS Files (*.efs)|*.efs|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    OpenFileOperation openFileOperation = new OpenFileOperation(openFileDialog.FileName, EFSSystem);
                    ProgressDialog    dialog            = new ProgressDialog("Opening file", openFileOperation);
                    dialog.ShowDialog();

                    // Open the windows
                    if (openFileOperation.Dictionary != null)
                    {
                        DataDictionary.Dictionary dictionary = openFileOperation.Dictionary;
                        DataDictionary.Generated.ControllersManager.NamableController.DesactivateNotification();

                        // Only open the specification window if specifications are available in the opened file
                        if (dictionary.Specifications != null && dictionary.Specifications.AllParagraphs.Count > 0)
                        {
                            AddChildWindow(new SpecificationView.Window(dictionary));
                        }

                        // Only open the model view window if model elements are available in the opened file
                        if (dictionary.NameSpaces.Count > 0)
                        {
                            AddChildWindow(new DataDictionaryView.Window(dictionary));
                        }

                        // Only shold the tests window if tests are defined in the opened file
                        if (dictionary.Tests.Count > 0)
                        {
                            IBaseForm testWindow = TestWindow;
                            if (testWindow == null)
                            {
                                AddChildWindow(new TestRunnerView.Window(EFSSystem));
                            }
                            else
                            {
                                testWindow.RefreshModel();
                            }
                        }

                        // Only open the shortcuts window if there are some shortcuts defined
                        if (dictionary.ShortcutsDictionary != null)
                        {
                            IBaseForm shortcutsWindow = ShortcutsWindow;
                            if (shortcutsWindow == null)
                            {
                                if (dictionary != null)
                                {
                                    Shortcuts.Window newWindow = new Shortcuts.Window(dictionary.ShortcutsDictionary);
                                    newWindow.Location = new System.Drawing.Point(Width - newWindow.Width - 20, 0);
                                    AddChildWindow(newWindow);
                                }
                            }
                            else
                            {
                                shortcutsWindow.RefreshModel();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Cannot open file, please see log file (GUI.Log) for more information", "Cannot open file", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                finally
                {
                    DataDictionary.Generated.ControllersManager.NamableController.ActivateNotification();
                }

                Refresh();
            }
        }
Exemple #30
0
        public T Get <T>(IBaseForm <T> form) where T : IBaseController
        {
            var argument = new ConstructorArgument(nameof(form), form);

            return(IoCContainer.Container.Get <T>(argument));
        }