Browse Source

Changed maximized to show taskbar and loaded new file popup on loaded

flabbet 5 years ago
parent
commit
b3e30c1094

+ 4 - 4
PixiEditor/ViewModels/ViewModelMain.cs

@@ -24,7 +24,7 @@ namespace PixiEditor.ViewModels
     {
     {
         public static ViewModelMain Current { get; set; } = null;
         public static ViewModelMain Current { get; set; } = null;
         public RelayCommand SelectToolCommand { get; set; } //Command that handles tool switching 
         public RelayCommand SelectToolCommand { get; set; } //Command that handles tool switching 
-        public RelayCommand GenerateDrawAreaCommand { get; set; } //Command that generates draw area
+        public RelayCommand OpenNewFilePopupCommand { get; set; } //Command that generates draw area
         public RelayCommand MouseMoveCommand { get; set; } //Command that is used to draw
         public RelayCommand MouseMoveCommand { get; set; } //Command that is used to draw
         public RelayCommand MouseDownCommand { get; set; }
         public RelayCommand MouseDownCommand { get; set; }
         public RelayCommand KeyDownCommand { get; set; }
         public RelayCommand KeyDownCommand { get; set; }
@@ -166,7 +166,7 @@ namespace PixiEditor.ViewModels
             BitmapManager.MouseController.StoppedRecordingChanges += MouseController_StoppedRecordingChanges;
             BitmapManager.MouseController.StoppedRecordingChanges += MouseController_StoppedRecordingChanges;
             ChangesController = new PixelChangesController();
             ChangesController = new PixelChangesController();
             SelectToolCommand = new RelayCommand(SetTool, DocumentIsNotNull);
             SelectToolCommand = new RelayCommand(SetTool, DocumentIsNotNull);
-            GenerateDrawAreaCommand = new RelayCommand(GenerateDrawArea);
+            OpenNewFilePopupCommand = new RelayCommand(OpenNewFilePopup);
             MouseMoveCommand = new RelayCommand(MouseMove);
             MouseMoveCommand = new RelayCommand(MouseMove);
             MouseDownCommand = new RelayCommand(MouseDown);
             MouseDownCommand = new RelayCommand(MouseDown);
             SaveFileCommand = new RelayCommand(SaveFile, CanSave);
             SaveFileCommand = new RelayCommand(SaveFile, CanSave);
@@ -212,7 +212,7 @@ namespace PixiEditor.ViewModels
                     new Shortcut(Key.Y, RedoCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.Y, RedoCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.Z, UndoCommand),
                     new Shortcut(Key.Z, UndoCommand),
                     new Shortcut(Key.S, SaveFileCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.S, SaveFileCommand, modifier: ModifierKeys.Control),
-                    new Shortcut(Key.N, GenerateDrawAreaCommand, modifier: ModifierKeys.Control),
+                    new Shortcut(Key.N, OpenNewFilePopupCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.S, SaveFileCommand, "AsNew", ModifierKeys.Control | ModifierKeys.Shift),
                     new Shortcut(Key.S, SaveFileCommand, "AsNew", ModifierKeys.Control | ModifierKeys.Shift),
                     new Shortcut(Key.D, DeselectCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.D, DeselectCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.A, SelectAllCommand, modifier: ModifierKeys.Control),
                     new Shortcut(Key.A, SelectAllCommand, modifier: ModifierKeys.Control),
@@ -505,7 +505,7 @@ namespace PixiEditor.ViewModels
         /// Generates new Layer and sets it as active one
         /// Generates new Layer and sets it as active one
         /// </summary>
         /// </summary>
         /// <param name="parameter"></param>
         /// <param name="parameter"></param>
-        public void GenerateDrawArea(object parameter)
+        public void OpenNewFilePopup(object parameter)
         {
         {
             NewFileDialog newFile = new NewFileDialog();
             NewFileDialog newFile = new NewFileDialog();
             if (newFile.ShowDialog())
             if (newFile.ShowDialog())

+ 4 - 2
PixiEditor/Views/MainWindow.xaml

@@ -15,8 +15,7 @@
         xmlns:cmd="http://www.galasoft.ch/mvvmlight" xmlns:shell="clr-namespace:Microsoft.Windows.Shell;assembly=Xceed.Wpf.AvalonDock"
         xmlns:cmd="http://www.galasoft.ch/mvvmlight" xmlns:shell="clr-namespace:Microsoft.Windows.Shell;assembly=Xceed.Wpf.AvalonDock"
         mc:Ignorable="d" WindowStyle="None" 
         mc:Ignorable="d" WindowStyle="None" 
         Title="PixiEditor" Name="mainWindow" Height="1000" Width="1600" Background="{StaticResource MainColor}" 
         Title="PixiEditor" Name="mainWindow" Height="1000" Width="1600" Background="{StaticResource MainColor}" 
-        WindowStartupLocation="CenterScreen"  WindowState="Maximized" DataContext="{DynamicResource ViewModelMain}">
-
+        WindowStartupLocation="CenterScreen" WindowState="Maximized" DataContext="{DynamicResource ViewModelMain}">
     <WindowChrome.WindowChrome>
     <WindowChrome.WindowChrome>
         <WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
         <WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
     </WindowChrome.WindowChrome>
     </WindowChrome.WindowChrome>
@@ -40,6 +39,9 @@
         <i:EventTrigger EventName="KeyDown">
         <i:EventTrigger EventName="KeyDown">
             <cmd:EventToCommand Command="{Binding KeyDownCommand}" PassEventArgsToCommand="True"/>
             <cmd:EventToCommand Command="{Binding KeyDownCommand}" PassEventArgsToCommand="True"/>
         </i:EventTrigger>
         </i:EventTrigger>
+        <i:EventTrigger EventName="ContentRendered">
+            <i:InvokeCommandAction Command="{Binding OpenNewFilePopupCommand}"/>
+        </i:EventTrigger>
     </i:Interaction.Triggers>
     </i:Interaction.Triggers>
     <Grid Name="mainGrid" Margin="5">
     <Grid Name="mainGrid" Margin="5">
         <Grid.ColumnDefinitions>
         <Grid.ColumnDefinitions>

+ 2 - 1
PixiEditor/Views/MainWindow.xaml.cs

@@ -12,7 +12,8 @@ namespace PixiEditor
         public MainWindow()
         public MainWindow()
         {
         {
             InitializeComponent();
             InitializeComponent();
-            this.StateChanged += MainWindowStateChangeRaised;
+            StateChanged += MainWindowStateChangeRaised;
+            MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
         }
         }
 
 
         private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
         private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)