Ejemplo n.º 1
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);
                    }
                }
            }
        }
Ejemplo n.º 2
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);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void switchLayout(KCVContentLayout newValue)
 {
     switchLayout(KCVContentLayout.Portrait, newValue, true);
 }
Ejemplo n.º 4
0
 private void switchLayout(KCVContentLayout newValue)
 {
     switchLayout(KCVContentLayout.Portrait, newValue, true);
 }