コード例 #1
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            (this.Content as Grid).Children.Remove(KCVUIHelper.KCVContent);

            if (PluginSettings.Current.Layout == KCVContentLayout.Separate)
                LandscapeViewModel.Instance.IsWindowOpenButtonShow = true;
            Current = null;
        }
コード例 #2
0
        public MainContentWindow()
        {
            InitializeComponent();

            Current = this;
            MainWindow.Current.Closed += (sender, args) => this.Close();

            var content = KCVUIHelper.KCVContent;
            (this.Content as Grid).Children.Add(content);
            Grid.SetRow(content, 1);
        }
コード例 #3
0
 public void OpenWindow()
 {
     if (CurrentLayout == KCVContentLayout.Separate && MainContentWindow.Current == null)
     {
         var window = new MainContentWindow {
             DataContext = KCVApp.ViewModelRoot
         };
         window.Show();
         this.IsWindowOpenButtonShow = false;
     }
 }
コード例 #4
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            (this.Content as Grid).Children.Remove(KCVUIHelper.KCVContent);

            if (PluginSettings.Current.Layout == KCVContentLayout.Separate)
            {
                LandscapeViewModel.Instance.IsWindowOpenButtonShow = true;
            }
            Current = null;
        }
コード例 #5
0
        public MainContentWindow()
        {
            InitializeComponent();

            Current = this;
            MainWindow.Current.Closed += (sender, args) => this.Close();

            var content = KCVUIHelper.KCVContent;

            (this.Content as Grid).Children.Add(content);
            Grid.SetRow(content, 1);
        }
コード例 #6
0
        private void switchLayout(KCVContentLayout oldValue, KCVContentLayout newValue, bool initializing = false)
        {
            if (oldValue == newValue) return;

            if (oldValue == KCVContentLayout.Separate)
            {
                if (newValue == KCVContentLayout.Portrait)
                {
                    resizeWindow(Math.Max(this.HostWidth, MainContentWindow.Current.ActualWidth), this.HostHeight + MainContentWindow.Current.ActualHeight);
                }
                else
                {
                    resizeWindow(this.HostWidth + MainContentWindow.Current.ActualWidth, Math.Max(this.HostHeight, MainContentWindow.Current.ActualHeight));
                }
                MainContentWindow.Current.Close();
                contentContainer.Children.Add(pluginControl);
                this.IsWindowOpenButtonShow = false;
            }

            contentContainer.RowDefinitions.Clear();
            contentContainer.ColumnDefinitions.Clear();

            if (newValue == KCVContentLayout.Separate)
            {
                contentContainer.Children.Remove(pluginControl);
                var window = new MainContentWindow { DataContext = KCVApp.ViewModelRoot };
                window.Show();

                resizeWindow(this.HostWidth, this.HostHeight);
            }
            else
            {
                if (newValue == KCVContentLayout.Portrait)
                {
                    if (oldValue != KCVContentLayout.Separate)
                    {
                        resizeWindow(Math.Max(this.HostWidth, pluginControl.ActualWidth), this.HostHeight + pluginControl.ActualHeight);
                    }

                    contentContainer.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
                    contentContainer.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });

                    Grid.SetRow(pluginControl, 1);
                }
                else
                {
                    if (newValue == KCVContentLayout.LandscapeLeft)
                    {
                        if (oldValue == KCVContentLayout.Portrait && !initializing)
                        {
                            resizeWindow(this.HostWidth + pluginControl.ActualWidth, Math.Max(this.HostHeight, pluginControl.ActualHeight));
                        }

                        contentContainer.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
                        contentContainer.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });

                        Grid.SetColumn(hostControl, 0);
                        Grid.SetColumn(pluginControl, 1);
                    }
                    else
                    {
                        if (oldValue == KCVContentLayout.Portrait && !initializing)
                        {
                            resizeWindow(this.HostWidth + pluginControl.ActualWidth, Math.Max(this.HostHeight, pluginControl.ActualHeight));
                        }

                        contentContainer.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
                        contentContainer.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });

                        Grid.SetColumn(hostControl, 1);
                        Grid.SetColumn(pluginControl, 0);
                    }
                }
            }
        }
コード例 #7
0
 public void OpenWindow()
 {
     if (CurrentLayout == KCVContentLayout.Separate && MainContentWindow.Current == null)
     {
         var window = new MainContentWindow { DataContext = KCVApp.ViewModelRoot };
         window.Show();
         this.IsWindowOpenButtonShow = false;
     }
 }
コード例 #8
0
        private void switchLayout(KCVContentLayout oldValue, KCVContentLayout newValue, bool initializing = false)
        {
            if (oldValue == newValue)
            {
                return;
            }

            if (oldValue == KCVContentLayout.Separate)
            {
                if (newValue == KCVContentLayout.Portrait)
                {
                    resizeWindow(Math.Max(this.HostWidth, MainContentWindow.Current.ActualWidth), this.HostHeight + MainContentWindow.Current.ActualHeight);
                }
                else
                {
                    resizeWindow(this.HostWidth + MainContentWindow.Current.ActualWidth, Math.Max(this.HostHeight, MainContentWindow.Current.ActualHeight));
                }
                MainContentWindow.Current.Close();
                contentContainer.Children.Add(pluginControl);
                this.IsWindowOpenButtonShow = false;
            }

            contentContainer.RowDefinitions.Clear();
            contentContainer.ColumnDefinitions.Clear();

            if (newValue == KCVContentLayout.Separate)
            {
                contentContainer.Children.Remove(pluginControl);
                var window = new MainContentWindow {
                    DataContext = KCVApp.ViewModelRoot
                };
                window.Show();

                resizeWindow(this.HostWidth, this.HostHeight);
            }
            else
            {
                if (newValue == KCVContentLayout.Portrait)
                {
                    if (oldValue != KCVContentLayout.Separate)
                    {
                        resizeWindow(Math.Max(this.HostWidth, pluginControl.ActualWidth), this.HostHeight + pluginControl.ActualHeight);
                    }

                    contentContainer.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Auto)
                    });
                    contentContainer.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Star)
                    });

                    Grid.SetRow(pluginControl, 1);
                }
                else
                {
                    if (newValue == KCVContentLayout.LandscapeLeft)
                    {
                        if (oldValue == KCVContentLayout.Portrait && !initializing)
                        {
                            resizeWindow(this.HostWidth + pluginControl.ActualWidth, Math.Max(this.HostHeight, pluginControl.ActualHeight));
                        }

                        contentContainer.ColumnDefinitions.Add(new ColumnDefinition()
                        {
                            Width = new GridLength(1, GridUnitType.Auto)
                        });
                        contentContainer.ColumnDefinitions.Add(new ColumnDefinition()
                        {
                            Width = new GridLength(1, GridUnitType.Star)
                        });

                        Grid.SetColumn(hostControl, 0);
                        Grid.SetColumn(pluginControl, 1);
                    }
                    else
                    {
                        if (oldValue == KCVContentLayout.Portrait && !initializing)
                        {
                            resizeWindow(this.HostWidth + pluginControl.ActualWidth, Math.Max(this.HostHeight, pluginControl.ActualHeight));
                        }

                        contentContainer.ColumnDefinitions.Add(new ColumnDefinition()
                        {
                            Width = new GridLength(1, GridUnitType.Star)
                        });
                        contentContainer.ColumnDefinitions.Add(new ColumnDefinition()
                        {
                            Width = new GridLength(1, GridUnitType.Auto)
                        });

                        Grid.SetColumn(hostControl, 1);
                        Grid.SetColumn(pluginControl, 0);
                    }
                }
            }
        }