コード例 #1
0
ファイル: Menu.cs プロジェクト: leemcknight/VLoop.NET
        private void OnMenuClick(object sender, System.EventArgs e)
        {
            try
            {
                //the key is either an action or an IViewExplorer.
                object key = ((AfniMenuItem)sender).Key;


                VLoopCommand cmd = key as VLoopCommand;
                if (cmd != null)
                {
                    cmd.Execute( );
                }
                else
                {
                    IViewExplorer explorer = key as IViewExplorer;
                    if (explorer != null)
                    {
                        _app.LoadExplorer(explorer);
                    }
                }
            }
            catch
            {
                MessageBox.Show("Unable to perform action.",
                                "VLoop Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
コード例 #2
0
 private void tbVLoop_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
 {
     try
     {
         if (e.Button == this.btnBack)
         {
             _app.MovePrevView();
         }
         else if (e.Button == this.btnForward)
         {
             _app.MoveNextView();
         }
         else
         {
             VLoopCommand cmd = (VLoopCommand)e.Button.Tag;
             cmd.Execute();
         }
     }
     catch
     {
         MessageBox.Show("Unable to perfom requested action",
                         "VLoop error",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }
コード例 #3
0
ファイル: Menu.cs プロジェクト: leemcknight/VLoop.NET
        public MenuItem AddMenuItem(VLoopCommand MenuAction,
                                    VLoopMenus MenuType,
                                    ToolBarButton TBButton,
                                    string MenuText,
                                    Shortcut MenuShortcut,
                                    Icon MenuIcon)
        {
            Menu menu = GetMenu(MenuType);

            AfniMenuItem item = new AfniMenuItem();


            item.Text     = MenuText;
            item.Shortcut = MenuShortcut;
            item.Click   += new System.EventHandler(this.OnMenuClick);
            item.Icon     = MenuIcon;
            item.Key      = MenuAction;

            menu.MenuItems.Add(item);
            if (TBButton != null)
            {
                _app.ParentForm.VLoopToolBar.Buttons.Add(TBButton);
            }

            return(item);
        }
コード例 #4
0
        private void OnViewTaskClicked(object sender, EventArgs e)
        {
            ActionTypes  key = (ActionTypes)((AfniLink)sender).Tag;
            VLoopCommand cmd = (VLoopCommand)_app.Commands[key];

            cmd.Execute();
        }