Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnMainViewOpened(object args)
        {
            try
            {
                if (args is PaMainWnd)
                {
                    m_mainWnd = args as PaMainWnd;
                    m_adapter = PaApp.TMAdapter;

                    m_adapter.AddCommandItem("CmdSendFeedback", "SendFeedback",
                                             Properties.Resources.kstidFeedbackMenuText, null, null, null, null,
                                             null, Keys.None, null, Properties.Resources.kimidSendFeedback);

                    m_feedbackItemProps            = new TMItemProperties();
                    m_feedbackItemProps.BeginGroup = true;
                    m_feedbackItemProps.CommandId  = "CmdSendFeedback";
                    m_feedbackItemProps.Name       = "mnuSendFeedback";
                    m_feedbackItemProps.Text       = null;
                    m_adapter.AddMenuItem(m_feedbackItemProps, "mnuHelp", "mnuHelpAbout");

                    // Get the number of times PA has been launched.
                    int launchCount = PaApp.SettingsHandler.GetIntSettingsValue(
                        "feedbackaddon", "launchcount", 0);

                    // Increase the launch count by one and save it.
                    PaApp.SettingsHandler.SaveSettingsValue(
                        "feedbackaddon", "launchcount", ++launchCount);

                    // If we've reached the tenth time PA has been run, then show
                    // the user the dialog requesting feedback.
                    if (launchCount == 10)
                    {
                        using (RequestDlg dlg = new RequestDlg())
                        {
                            if (dlg.ShowDialog(m_mainWnd) == DialogResult.Yes)
                            {
                                OnSendFeedback(null);
                            }
                        }
                    }
                }
            }
            catch { }

            return(false);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void SetupFilterMenu()
        {
            try
            {
                if (m_adapter == null)
                {
                    return;
                }

                m_adapter.AddCommandItem("CmdFilters", "DisplayFilterDlg",
                                         Properties.Resources.kstidFiltersMenuText, null, null, null, null,
                                         null, Keys.None, null, Properties.Resources.kimidDefineFilters);

                TMItemProperties itemProps = new TMItemProperties();
                itemProps.CommandId = "CmdFilters";
                itemProps.Name      = "mnuFilters";
                itemProps.Text      = null;
                m_adapter.AddMenuItem(itemProps, "mnuFile", "mnuUndefinedCharacters");
            }
            catch { }
        }
Exemplo n.º 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Tells the side bar adapter to setup it's menus so they show up on the application's
		/// view menu. This method should be called after all the tabs and tab items have been
		/// created.
		/// </summary>
		/// <param name="menuAdapter">Menu adapter used by the application.</param>
		/// <param name="insertBeforeItem">Name of the menu item before which the sidebar
		/// menus will be added.</param>
		/// ------------------------------------------------------------------------------------
		public void SetupViewMenuForSideBarTabs(ITMAdapter adapter, string insertBeforeItem)
		{
			TMAdapter dnbAdapter = adapter as TMAdapter;

			if (dnbAdapter == null || dnbAdapter.m_dnbMngr == null)
			{
				// Use this block when the menu adapter isn't one or our DNB ones defined in
				// this assembly. TODO: Need to call AddItem for each subitem in each tab's menu.
				foreach (SideBarTab tab in m_navPane.Items)
					adapter.AddMenuItem(tab.MenuItemProperties, null, insertBeforeItem);
			}

			// When the menu adapter is one of a type from our assembly, then use it's DNB
			// manager instead of the one instantiated in SetupSideBarsContextMenu. Add the
			// side bar's context menu to the DNB manager and set it to popup for as the
			// side bar's default context menu.
			m_dnbMngr = dnbAdapter.m_dnbMngr;
			m_dnbMngr.ContextMenus.Add(m_contextMenu);
			m_dnbMngr.SetContextMenuEx(m_navPane, "sbcontextmenu");

			// Insert our tab's menus before the specified item.
			foreach (SideBarTab tab in m_navPane.Items)
			{
				dnbAdapter.InsertMenuItem(tab.Menu, insertBeforeItem, false);
				tab.Menu.Visible = true;
			}
		}
Exemplo n.º 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Tells the side bar adapter to setup it's menus so they show up on the application's
		/// view menu. This method should be called after all the tabs and tab items have been
		/// created.
		/// </summary>
		/// <param name="menuAdapter">Menu adapter used by the application.</param>
		/// <param name="insertBeforeItem">Name of the menu item before which the sidebar
		/// menus will be added.</param>
		/// ------------------------------------------------------------------------------------
		public void SetupViewMenuForSideBarTabs(ITMAdapter adapter, string insertBeforeItem)
		{
			Debug.Assert(adapter != null);
			adapter.MessageMediator.AddColleague(this);

			foreach (SideBarTab tab in m_navPane.Items)
			{
				// Add the menu for the view tab.
				TMItemProperties props = tab.MenuItemProperties;
				props.Message = "SideBarViewTabMenuHandler";
				adapter.AddMenuItem(props, null, insertBeforeItem);

				// Add menus for the view tab items.
				foreach (TMItemProperties itemProps in tab.SubMenuItemProperties)
				{
					itemProps.Text = itemProps.Text.Replace(Environment.NewLine, " ");
					itemProps.Message = "SideBarViewTabItemMenuHandler";
					adapter.AddMenuItem(itemProps, tab.MenuItemProperties.Name, null);
				}

				// Add the menu item for the view tab's configure menu.
				SBTabProperties tabProps = tab.Properties;
				props = new TMItemProperties();
				props.Name = tab.Name + "Config";
				props.Text = tabProps.ConfigureMenuText;
				props.Message = tabProps.ConfigureMessage;
				props.BeginGroup = true;
				props.Tag = tabProps;
				adapter.AddMenuItem(props, tab.MenuItemProperties.Name, null);
			}
		}