示例#1
0
        /// <summary>
        ///         /// Öffnet oder erstellt einen Tab mit entsprechenden Namen. Navigiert das Frame zur Seite und hebt
        /// die zugehörige Navigations-Schaltfläche hervor.
        /// </summary>
        /// <param name="tabName">Der Name des zu öffnenden oder zu erstellenden Tabs.</param>
        /// <param name="page">Die Seite, die geöffnet werden soll.</param>
        /// <param name="pageName"></param>
        /// <returns>Der geöffnete Tab.</returns>
        private FrameTabItem OpenPage(string tabName, Page page, string pageName = null)
        {
            if (pageName == null)
            {
                pageName = tabName;
            }

            FrameTabItem item = MyFrameManager.GetTabItem(tabName);

            if (item == null)
            {
                item = MyFrameManager.OpenAndSelectNewTab(tabName);
                MyFrameManager.NavigateTabToPage(page);
            }
            else
            {
                MyFrameManager.SwitchToTab(tabName);
            }
            if (!pageName.Equals(item.SelectedPage))
            {
                MyFrameManager.NavigateTabToPage(page);
            }
            item.SelectedPage = pageName;
            HighlightNavigationButton(pageName);
            return(item);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="jobConfig"></param>
        private void OpenJob(JobConfig jobConfig)
        {
            if (jobConfig == null)
            {
                return;
            }

            MyJobManager.SelectedJobConfig = jobConfig;
            MyJobManager.AddRecentJob(jobConfig);
            SwitchJobButtonsVisibility(true);

            if (!MyJobManager.IsJobOpened(jobConfig))
            {
                MyJobManager.AddOpenedJob(jobConfig);
            }

            string       path = MyJobManager.GetJobConfigPath(jobConfig);
            Page         page = new SettingsPage(_settingsStartPage, jobConfig, new JobWriter(path));
            FrameTabItem item = OpenPage(jobConfig.Id, page, _settingsStartPage);

            item.IsJobPage = true;

            if (_jobExplorerExpanded)
            {
                SwitchJobbExplorerExpanded();
            }
        }
示例#3
0
        private void InitDataBindings()
        {
            Binding jobListBinding = new()
            {
                Source = MyJobManager,
                Path   = new PropertyPath("JobIds"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            };

            BindingOperations.SetBinding(JobListView, ItemsControl.ItemsSourceProperty, jobListBinding);

            Binding currentJobBinding = new()
            {
                Source = MyJobManager,
                Path   = new PropertyPath("SelectedJobConfig.Id"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                FallbackValue       = ""
            };

            BindingOperations.SetBinding(CurrentJobText, TextBlock.TextProperty, currentJobBinding);

            Binding openJobBinding = new()
            {
                Source = MyFrameManager,
                Path   = new PropertyPath("FrameTabItems"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
            };

            BindingOperations.SetBinding(ContentTabControl, ItemsControl.ItemsSourceProperty, openJobBinding);
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NavButton_Click(object sender, RoutedEventArgs e)
        {
            if (sender is ToggleButton navButton)
            {
                string       pageName  = navButton.Content.ToString();
                JobConfig    jobConfig = MyJobManager.SelectedJobConfig;
                string       path      = MyJobManager.GetJobConfigPath(jobConfig);
                Page         page      = new SettingsPage(pageName, jobConfig, new JobWriter(path));
                FrameTabItem item      = OpenPage(jobConfig.Id, page, pageName);
                item.IsJobPage = true;
            }
        }
示例#4
0
 /// <summary>
 /// Schließt den entsprechenden Tab.
 /// </summary>
 /// <param name="item"></param>
 private void CloseTab(FrameTabItem item)
 {
     MyJobManager.RemoveOpenedJob(item.Header);
     MyFrameManager.CloseTab(item);
 }