Example #1
0
        private void Open(object sender, RoutedEventArgs e)
        {
            if (PromptToSaveBeforeClosing())
            {
                OpenFileDialog dialog = new OpenFileDialog();
#if !SILVERLIGHT
                dialog.DefaultExt = ".xml";
#endif
                dialog.Filter      = "Rawr Batch Files | *.xml";
                dialog.Multiselect = false;
                if (dialog.ShowDialog().GetValueOrDefault())
                {
#if SILVERLIGHT
                    _filePath = dialog.File.FullName;
#else
                    _filePath = dialog.FileName;
#endif
                    batchTools.BatchCharacterList = BatchCharacterList.Load(_filePath);
                }
            }
        }
Example #2
0
        private void Import(object sender, RoutedEventArgs e)
        {
            if (PromptToSaveBeforeClosing())
            {
                OpenFileDialog dialog = new OpenFileDialog();
#if !SILVERLIGHT
                dialog.DefaultExt = ".xml";
#endif
                dialog.Filter      = "Rawr Xml Character Files | *.xml";
                dialog.Multiselect = true;
                if (dialog.ShowDialog().GetValueOrDefault())
                {
                    _unsavedChanges = true;
                    _filePath       = null;
                    BatchCharacterList list = new BatchCharacterList();
#if SILVERLIGHT
                    foreach (FileInfo file in dialog.Files)
                    {
                        // we can only securely read the file name
                        using (StreamReader reader = file.OpenText())
                        {
                            list.Add(new BatchCharacter()
                            {
                                RelativePath = file.Name, Character = Character.LoadFromXml(reader.ReadToEnd())
                            });
                        }
                    }
#else
                    foreach (string filename in dialog.FileNames)
                    {
                        list.Add(new BatchCharacter()
                        {
                            RelativePath = RelativePath(filename, AppDomain.CurrentDomain.BaseDirectory)
                        });
                    }
#endif
                    batchTools.BatchCharacterList = list;
                }
            }
        }
Example #3
0
		private void Import(object sender, RoutedEventArgs e)
		{
			if (PromptToSaveBeforeClosing())
			{
				OpenFileDialog dialog = new OpenFileDialog();
#if !SILVERLIGHT
				dialog.DefaultExt = ".xml";
#endif
				dialog.Filter = "Rawr Xml Character Files | *.xml";
				dialog.Multiselect = true;
				if (dialog.ShowDialog().GetValueOrDefault())
				{
					_unsavedChanges = true;
					_filePath = null;
					BatchCharacterList list = new BatchCharacterList();
#if SILVERLIGHT
					foreach (FileInfo file in dialog.Files)
					{
						// we can only securely read the file name
						using (StreamReader reader = file.OpenText())
						{
							list.Add(new BatchCharacter() { RelativePath = file.Name, Character = Character.LoadFromXml(reader.ReadToEnd()) });
						}
					}
#else
					foreach (string filename in dialog.FileNames)
					{
						list.Add(new BatchCharacter() { RelativePath = RelativePath(filename, AppDomain.CurrentDomain.BaseDirectory) });
					}
#endif
					batchTools.BatchCharacterList = list;
				}
			}
		}
Example #4
0
        public BatchTools()
        {
            MaxRounds = 3;
            BatchCharacterList = new BatchCharacterList();
            batchListReady = true;

            optimizer = new ItemInstanceOptimizer();
            optimizer.OptimizeCharacterProgressChanged += new OptimizeCharacterProgressChangedEventHandler(_optimizer_OptimizeCharacterProgressChanged);
            optimizer.OptimizeCharacterCompleted += new OptimizeCharacterCompletedEventHandler(_optimizer_OptimizeCharacterCompleted);
            optimizer.ComputeUpgradesProgressChanged += new ComputeUpgradesProgressChangedEventHandler(_optimizer_ComputeUpgradesProgressChanged);
            optimizer.ComputeUpgradesCompleted += new ComputeUpgradesCompletedEventHandler(_optimizer_ComputeUpgradesCompleted);
            optimizer.EvaluateUpgradeProgressChanged += new ProgressChangedEventHandler(_optimizer_EvaluateUpgradeProgressChanged);
            optimizer.EvaluateUpgradeCompleted += new EvaluateUpgradeCompletedEventHandler(_optimizer_EvaluateUpgradeCompleted);
        }