Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
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;
            }
        }