Пример #1
0
        void TabControl_OnTabClicked(object TabData, Point Location, MouseButtons Buttons)
        {
            if (Buttons == System.Windows.Forms.MouseButtons.Right)
            {
                Activate();

                int InsertIdx = 0;

                while (TabMenu_RecentProjects.DropDownItems[InsertIdx] != TabMenu_Recent_Separator)
                {
                    TabMenu_RecentProjects.DropDownItems.RemoveAt(InsertIdx);
                }

                TabMenu_TabIdx = -1;
                for (int Idx = 0; Idx < TabControl.GetTabCount(); Idx++)
                {
                    if (TabControl.GetTabData(Idx) == TabData)
                    {
                        TabMenu_TabIdx = Idx;
                        break;
                    }
                }

                HashSet <string> ProjectList = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);
                foreach (string ProjectFileName in Settings.OtherProjectFileNames)
                {
                    if (!String.IsNullOrEmpty(ProjectFileName))
                    {
                        string FullProjectFileName = Path.GetFullPath(ProjectFileName);
                        if (ProjectList.Add(FullProjectFileName))
                        {
                            ToolStripMenuItem Item = new ToolStripMenuItem(FullProjectFileName, null, new EventHandler((o, e) => TryOpenProject(FullProjectFileName, TabMenu_TabIdx)));
                            TabMenu_RecentProjects.DropDownItems.Insert(InsertIdx, Item);
                            InsertIdx++;
                        }
                    }
                }

                TabMenu_RecentProjects.Visible = (ProjectList.Count > 0);

                TabMenu_TabNames_Stream.Checked        = Settings.TabLabels == TabLabels.Stream;
                TabMenu_TabNames_WorkspaceName.Checked = Settings.TabLabels == TabLabels.WorkspaceName;
                TabMenu_TabNames_WorkspaceRoot.Checked = Settings.TabLabels == TabLabels.WorkspaceRoot;
                TabMenu_TabNames_ProjectFile.Checked   = Settings.TabLabels == TabLabels.ProjectFile;
                TabMenu.Show(TabControl, Location);

                TabControl.LockHover();
            }
        }
Пример #2
0
        void TabControl_OnTabClicked(object TabData, Point Location, MouseButtons Buttons)
        {
            if (Buttons == System.Windows.Forms.MouseButtons.Right)
            {
                Activate();

                int InsertIdx = 0;

                while (TabMenu_RecentProjects.DropDownItems[InsertIdx] != TabMenu_Recent_Separator)
                {
                    TabMenu_RecentProjects.DropDownItems.RemoveAt(InsertIdx);
                }

                TabMenu_TabIdx = -1;
                for (int Idx = 0; Idx < TabControl.GetTabCount(); Idx++)
                {
                    if (TabControl.GetTabData(Idx) == TabData)
                    {
                        TabMenu_TabIdx = Idx;
                        break;
                    }
                }

                foreach (UserSelectedProjectSettings RecentProject in Settings.RecentProjects)
                {
                    ToolStripMenuItem Item = new ToolStripMenuItem(RecentProject.ToString(), null, new EventHandler((o, e) => TryOpenProject(RecentProject, TabMenu_TabIdx)));
                    TabMenu_RecentProjects.DropDownItems.Insert(InsertIdx, Item);
                    InsertIdx++;
                }

                TabMenu_RecentProjects.Visible = (Settings.RecentProjects.Count > 0);

                TabMenu_TabNames_Stream.Checked        = Settings.TabLabels == TabLabels.Stream;
                TabMenu_TabNames_WorkspaceName.Checked = Settings.TabLabels == TabLabels.WorkspaceName;
                TabMenu_TabNames_WorkspaceRoot.Checked = Settings.TabLabels == TabLabels.WorkspaceRoot;
                TabMenu_TabNames_ProjectFile.Checked   = Settings.TabLabels == TabLabels.ProjectFile;
                TabMenu.Show(TabControl, Location);

                TabControl.LockHover();
            }
        }
Пример #3
0
        private void btnApplyUser_Click(object sender, RoutedEventArgs e)
        {
            // Getting a user and checking for a password


            try
            {
                using (ApplicationContext db = new ApplicationContext())
                {
                    string tempName = comboBoxUsers.SelectedItem.ToString();

                    User user = db.Users.FirstOrDefault(u => u.Username == tempName);

                    idUserForPassword = user.Id; // Getting User Id

                    if (passwordBoxApplyPassword.Password == user.Password)
                    {
                        TabMenu tabMenu = new TabMenu(idUserForPassword);
                        tabMenu.Show();
                        tabMenu.ShowInTaskbar = false;
                    }
                    else
                    {
                        passwordBoxApplyPassword.Clear();
                        ErrorPassword errorPassword = new ErrorPassword(idUserForPassword);
                        errorPassword.ShowDialog();
                        errorPassword.ShowInTaskbar = false;
                    }
                }
            }

            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }