コード例 #1
0
        /// <summary>
        /// The on diagram style window changed.
        /// </summary>
        /// <param name="d">
        /// The d.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private static void OnDiagramStyleWindowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            OpenCloseWindowBehavior openCloseBehavior = (OpenCloseWindowBehavior)d;

            if ((bool)e.NewValue)
            {
                object instance = Activator.CreateInstance(typeof(DiagramStyleWindow));
                if (instance is Window)
                {
                    Window window = (Window)instance;
                    window.Owner = Application.Current.MainWindow;
                    if (window.DataContext == null)
                    {
                        openCloseBehavior.BrainstormingBuilderVM.DiagramStyleViewModel.UpdateTopics();
                        window.DataContext = openCloseBehavior.BrainstormingBuilderVM.DiagramStyleViewModel;
                        DiagramStyleViewModel diagramStyleViewModel = window.DataContext as DiagramStyleViewModel;
                        if (diagramStyleViewModel.StyleDiagram == null)
                        {
                            diagramStyleViewModel.StyleDiagram = window.Resources["DiagramVM"] as BrainstormingVM;
                        }

                        if (diagramStyleViewModel.StyleDiagram.Theme
                            != openCloseBehavior.BrainstormingBuilderVM.SelectedDiagram.Theme)
                        {
                            diagramStyleViewModel.StyleDiagram.Theme =
                                openCloseBehavior.BrainstormingBuilderVM.SelectedDiagram.Theme;
                            diagramStyleViewModel.GenerateThemeStyleCollection();
                        }

                        diagramStyleViewModel.ApplyLevelStyle();
                    }

                    window.Closing += (s, ev) =>
                    {
                        if (openCloseBehavior.OpenDiagramStyleWindow)
                        {
                            openCloseBehavior._windowInstance        = null;
                            openCloseBehavior.OpenDiagramStyleWindow = false;
                        }
                    };
                    openCloseBehavior._windowInstance = window;
                    window.ShowDialog();
                }
                else
                {
                    if (openCloseBehavior._windowInstance != null)
                    {
                        openCloseBehavior._windowInstance.Close();
                    }
                }
            }
            else
            {
                if (openCloseBehavior._windowInstance != null)
                {
                    openCloseBehavior._windowInstance.Close();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// The on open multiple sub topic window changed.
        /// </summary>
        /// <param name="d">
        /// The d.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private static void OnOpenMultipleSubTopicWindowChanged(
            DependencyObject d,
            DependencyPropertyChangedEventArgs e)
        {
            OpenCloseWindowBehavior openCloseBehavior = (OpenCloseWindowBehavior)d;

            if ((bool)e.NewValue)
            {
                object instance = Activator.CreateInstance(typeof(MultipleSubTopicWindow));
                if (instance is Window)
                {
                    Window window = (Window)instance;
                    window.Owner = Application.Current.MainWindow;
                    if (window.DataContext == null)
                    {
                        window.DataContext = openCloseBehavior.BrainstormingBuilderVM.MultipleSubTopicViewModel;
                        (window.DataContext as MultipleSubTopicViewModel).SelectedItem = "Topic 1";
                    }

                    window.Closing += (s, ev) =>
                    {
                        if (openCloseBehavior.OpenMultipleSubTopicWindow)
                        {
                            openCloseBehavior._windowInstance            = null;
                            openCloseBehavior.OpenMultipleSubTopicWindow = false;
                        }
                    };
                    openCloseBehavior._windowInstance = window;
                    window.ShowDialog();
                }
                else
                {
                    if (openCloseBehavior._windowInstance != null)
                    {
                        openCloseBehavior._windowInstance.Close();
                    }
                }
            }
            else
            {
                if (openCloseBehavior._windowInstance != null)
                {
                    openCloseBehavior._windowInstance.Close();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// The on export message window changed.
        /// </summary>
        /// <param name="d">
        /// The d.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private static void OnExportMessageWindowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            OpenCloseWindowBehavior openCloseBehavior = (OpenCloseWindowBehavior)d;

            if ((bool)e.NewValue)
            {
                object instance = Activator.CreateInstance(typeof(ExportMessageWindow));
                if (instance is Window)
                {
                    Window window = (Window)instance;
                    window.Owner = Application.Current.MainWindow;
                    if (window.DataContext == null)
                    {
                        window.DataContext = new ExportMessageViewModel(openCloseBehavior.BrainstormingBuilderVM);
                    }

                    window.Closing += (s, ev) =>
                    {
                        if (openCloseBehavior.OpenExportMessageWindow)
                        {
                            openCloseBehavior._windowInstance         = null;
                            openCloseBehavior.OpenExportMessageWindow = false;
                        }
                    };
                    openCloseBehavior._windowInstance = window;
                    window.ShowDialog();
                }
                else
                {
                    if (openCloseBehavior._windowInstance != null)
                    {
                        openCloseBehavior._windowInstance.Close();
                    }
                }
            }
            else
            {
                if (openCloseBehavior._windowInstance != null)
                {
                    openCloseBehavior._windowInstance.Close();
                }
            }
        }