mirror of
				https://github.com/Strongleong/ScrapModLoader.git
				synced 2024-08-15 00:03:19 +00:00 
			
		
		
		
	Implemented choosing Scrapland version
This commit is contained in:
		
							parent
							
								
									e0c1beb5f1
								
							
						
					
					
						commit
						b168b7403a
					
				
					 4 changed files with 21 additions and 20 deletions
				
			
		|  | @ -66,9 +66,13 @@ | ||||||
|                 <ColumnDefinition Width="auto" /> |                 <ColumnDefinition Width="auto" /> | ||||||
|             </Grid.ColumnDefinitions> |             </Grid.ColumnDefinitions> | ||||||
|             <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">                 |             <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">                 | ||||||
|                 <Button Content=" Settings " Click="Button_Click" /> |                 <Button Name="ButtonSettings" Content=" Settings " Click="ButtonSettings_Click" /> | ||||||
|             </StackPanel> |             </StackPanel> | ||||||
|             <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Left"> |             <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Left"> | ||||||
|  |                 <ComboBox Name="ScraplandVersion" Margin="0,0,10,0"> | ||||||
|  |                     <ComboBoxItem Content="Original" IsEnabled="False" /> | ||||||
|  |                     <ComboBoxItem Content="Remastered" /> | ||||||
|  |                 </ComboBox> | ||||||
|                 <CheckBox Content=" Windowed " Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" /> |                 <CheckBox Content=" Windowed " Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" /> | ||||||
|                 <CheckBox Content=" Close launcher " Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" /> |                 <CheckBox Content=" Close launcher " Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" /> | ||||||
|                 <Button Content=" Run Scrapland " Name="ButtonRunScrapland" /> |                 <Button Content=" Run Scrapland " Name="ButtonRunScrapland" /> | ||||||
|  |  | ||||||
|  | @ -34,12 +34,21 @@ namespace ScrapModLoader | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             // TODO: Refactor it to separate window with pretty loading animation |             // TODO: Refactor it to separate window with pretty loading animation | ||||||
|             if (!modsLauncher.SearchForScrapland()) |             if (modsLauncher.ScraplandPath == String.Empty && modsLauncher.ScraplandRemasteredPath == String.Empty) | ||||||
|             { |             { | ||||||
|                 ButtonRunScrapland.IsEnabled = false; |                 Boolean isFoundScrapland = modsLauncher.SearchForScrapland(); | ||||||
|                 MessageBox.Show("Error: unable to find Scrapland instalation. Please, specify yours game installation folder in settings."); |                 if (!isFoundScrapland) | ||||||
|  |                 { | ||||||
|  |                     ButtonRunScrapland.IsEnabled = false; | ||||||
|  |                     MessageBox.Show("Error: unable to find Scrapland instalation. Please, specify yours game installation folder in settings."); | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  |             ((ComboBoxItem)ScraplandVersion.Items[0]).IsEnabled = modsLauncher.ScraplandPath != String.Empty; | ||||||
|  |             ((ComboBoxItem)ScraplandVersion.Items[1]).IsEnabled = modsLauncher.ScraplandRemasteredPath != String.Empty; | ||||||
|  | 
 | ||||||
|  |             ScraplandVersion.SelectedIndex = modsLauncher.ScraplandRemasteredPath != String.Empty ? 1 : 0; | ||||||
|  | 
 | ||||||
|             modsLauncher.ScanMods(); |             modsLauncher.ScanMods(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -136,9 +145,9 @@ namespace ScrapModLoader | ||||||
|             mod.Checked = (Boolean)isChecked; |             mod.Checked = (Boolean)isChecked; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void Button_Click(Object sender, RoutedEventArgs e) |         private void ButtonSettings_Click(Object sender, RoutedEventArgs e) | ||||||
|         { |         { | ||||||
|             SettingsWindow settingsWindow = new SettingsWindow(modsLauncher); |             SettingsWindow settingsWindow = new SettingsWindow(); | ||||||
|             settingsWindow.ShowDialog(); |             settingsWindow.ShowDialog(); | ||||||
|             if (settingsWindow.Save) |             if (settingsWindow.Save) | ||||||
|                 modsLauncher.ScanMods(); |                 modsLauncher.ScanMods(); | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ namespace ScrapModLoader | ||||||
|         public String ScraplandRemasteredPath { get; set; } |         public String ScraplandRemasteredPath { get; set; } | ||||||
|         public Boolean Save { get; set; } |         public Boolean Save { get; set; } | ||||||
| 
 | 
 | ||||||
|         public SettingsWindow(ModsLauncher modsLauncher) |         public SettingsWindow() | ||||||
|         { |         { | ||||||
|             InitializeComponent(); |             InitializeComponent(); | ||||||
| 
 | 
 | ||||||
|  | @ -118,7 +118,7 @@ namespace ScrapModLoader | ||||||
|         } |         } | ||||||
|         private void ButtonBrowseScrapRemaster_Click(Object sender, RoutedEventArgs e) |         private void ButtonBrowseScrapRemaster_Click(Object sender, RoutedEventArgs e) | ||||||
|         { |         { | ||||||
|             String scraplandRemasteredPath = Utils.GetFilePath(); |             String scraplandRemasteredPath = Utils.GetFolderDialog(); | ||||||
|             if (scraplandRemasteredPath != String.Empty) |             if (scraplandRemasteredPath != String.Empty) | ||||||
|             { |             { | ||||||
|                 ScraplandRemasteredPathTextBox.Text = scraplandRemasteredPath; |                 ScraplandRemasteredPathTextBox.Text = scraplandRemasteredPath; | ||||||
|  |  | ||||||
|  | @ -9,18 +9,6 @@ namespace ScrapModLoader | ||||||
| { | { | ||||||
|     internal static class Utils |     internal static class Utils | ||||||
|     { |     { | ||||||
|         public static String GetFilePath() |  | ||||||
|         { |  | ||||||
|             Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog |  | ||||||
|             { |  | ||||||
|                 DefaultExt = ".exe", |  | ||||||
|                 Filter = "Scrapland Executable File (*.exe)|*.exe" |  | ||||||
|             }; |  | ||||||
| 
 |  | ||||||
|             Nullable<Boolean> result = dlg.ShowDialog(); |  | ||||||
|             return dlg.FileName; |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         public static String GetFolderDialog() |         public static String GetFolderDialog() | ||||||
|         { |         { | ||||||
|             using System.Windows.Forms.FolderBrowserDialog? dialog = new System.Windows.Forms.FolderBrowserDialog(); |             using System.Windows.Forms.FolderBrowserDialog? dialog = new System.Windows.Forms.FolderBrowserDialog(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue