Exemplo n.º 1
0
 private void ReloadButton_Click( object sender, RoutedEventArgs e )
 {
     if( _saveFile != null )
     {
         _saveFile = new SaveFile( _saveFile.FileName );
         loadSavedInfo();
     }
 }
Exemplo n.º 2
0
 private void LoadButton_Click( object sender, RoutedEventArgs e )
 {
     try
     {
         Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
         dlg.Filter = "Just Cause 2 Save (.sav)|*.sav";
         Nullable<bool> result = dlg.ShowDialog();
         if( result == true )
         {
             _saveFile = new SaveFile( dlg.FileName );
             _fileSystemWatcher.Path = Path.GetDirectoryName(_saveFile.FileName);
             if (reloadInterval.SelectedIndex == 5)
             {
                 _fileSystemWatcher.EnableRaisingEvents = true;
             }
             FirePropertyChanged( "SaveFileIsLoaded" );
             loadSavedInfo();
         }
     }
     catch( Exception ex )
     {
         Error.Text = ex.Message;
         Renderer.AnimateOpacity( errorBorder, 0.75, 0, 8000 );
     }
 }
Exemplo n.º 3
0
 private void LoadButton_Click( object sender, RoutedEventArgs e )
 {
     try
     {
         Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
         dlg.Filter = "Just Cause 2 Save (.sav)|*.sav";
         Nullable<bool> result = dlg.ShowDialog();
         if( result == true )
         {
             _saveFile = new SaveFile( dlg.FileName );
             FirePropertyChanged( "SaveFileIsLoaded" );
             loadSavedInfo();
         }
     }
     catch( Exception ex )
     {
         Error.Text = ex.Message;
         Renderer.AnimateOpacity( errorBorder, 0.75, 0, 8000 );
     }
 }
Exemplo n.º 4
0
 private void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     try
     {
         _saveFile = new SaveFile(e.FullPath);
         Dispatcher.Invoke(new Action(loadSavedInfo));
     }
     catch (IOException)
     {
         // the game is still updating the save file
     }
 }
Exemplo n.º 5
0
		private void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
		{
			for (int i = 0; i < 5; i++)
			{
				try
				{
					_saveFile = new SaveFile(e.FullPath);
					Dispatcher.Invoke(new Action(loadSavedInfo));
					return;
				}
				catch (IOException)
				{
					// the game is still updating the save file
					Thread.Sleep(TimeSpan.FromSeconds(i + 1));
				}
			}
		}