예제 #1
0
        private void optimizer_OptimizeCharacterCompleted(object sender, OptimizeCharacterCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                MaxScoreLabel.Text = string.Empty;
                ControlsEnabled(true);
                AltProgress.Value = MainProgress.Value = 0;
            }
            else
            {
                AltProgress.Value = MainProgress.Value = 100;
                Character bestCharacter = e.OptimizedCharacter;
                if (bestCharacter == null)
                {
                    ControlsEnabled(true);
                    MessageBox.Show("Sorry, Rawr was unable to find a gearset to meet your requirements.", "Rawr Optimizer Results", MessageBoxButton.OK);
                }

                if (character != null)
                {
                    OptimizerResults results = new OptimizerResults(character, bestCharacter, false);
                    results.Closed += new EventHandler(results_Closed);
                    results.Show();
                }
                else
                {
                    ControlsEnabled(true);
                }
            }
        }
예제 #2
0
        private void resultsCancel_Closed(object sender, EventArgs e)
        {
            OptimizerResults results = sender as OptimizerResults;

            if (results.DialogResult.GetValueOrDefault())
            {
                if (results.WeWantToStoreIt) // continue
                {
                    optimizer.ResumeAsync();
                }
                else
                {
                    character.IsLoading = true;
                    character.SetItems(results.BestCharacter);
                    character.ActiveBuffs = results.BestCharacter.ActiveBuffs;
                    if (CK_Talents_Points.IsChecked.GetValueOrDefault())
                    {
                        character.CurrentTalents = results.BestCharacter.CurrentTalents;
                        MainPage.Instance.TalentPicker.RefreshSpec();
                    }
                    character.IsLoading = false;
                    character.OnCalculationsInvalidated();
                    optimizer.CancelAsync();
                    canClose     = true;
                    DialogResult = true;
                }
            }
            else
            {
                optimizer.CancelAsync();
                ControlsEnabled(true);
            }
        }
예제 #3
0
        private void results_Closed(object sender, EventArgs e)
        {
            OptimizerResults results = sender as OptimizerResults;

            if (results.DialogResult.GetValueOrDefault())
            {
                if (results.WeWantToStoreIt)
                {
                    ItemSet newItemSet = new ItemSet()
                    {
                        Name = string.Format("Optimized GearSet {0}", character.GetNumItemSetsFromOptimizer() + 1)
                    };
                    foreach (CharacterSlot cs in Character.EquippableCharacterSlots)
                    {
                        newItemSet.Add(results.BestCharacter[cs]);
                    }
                    character.AddToItemSetList(newItemSet);
                }
                else
                {
                    character.IsLoading = true;
                    character.SetItems(results.BestCharacter);
                    character.ActiveBuffs = results.BestCharacter.ActiveBuffs;
                    if (CK_Talents_Points.IsChecked.GetValueOrDefault())
                    {
                        character.CurrentTalents = results.BestCharacter.CurrentTalents;
                        MainPage.Instance.TalentPicker.RefreshSpec();
                    }
                    character.IsLoading = false;
                    character.OnCalculationsInvalidated();
                }
                DialogResult = true;
            }
            else
            {
                ControlsEnabled(true);
            }
        }
예제 #4
0
        private void results_Closed(object sender, EventArgs e)
        {
            OptimizerResults results = sender as OptimizerResults;

            if (results.DialogResult.GetValueOrDefault())
            {
                character.IsLoading = true;
                character.SetItems(results.BestCharacter);
                character.ActiveBuffs = results.BestCharacter.ActiveBuffs;
                if (TalentsCheck.IsChecked.GetValueOrDefault())
                {
                    character.CurrentTalents = results.BestCharacter.CurrentTalents;
                    MainPage.Instance.TalentPicker.RefreshSpec();
                }
                character.IsLoading = false;
                character.OnCalculationsInvalidated();
                DialogResult = true;
            }
            else
            {
                ControlsEnabled(true);
            }
        }
예제 #5
0
        private void DiffButton_Click(object sender, RoutedEventArgs e)
        {
#if SILVERLIGHT
            BatchCharacter character = (BatchCharacter)DataGrid.SelectedItem;
#else
            BatchCharacter character = (BatchCharacter)DataGrid.CurrentItem;
#endif
            Character before;
#if SILVERLIGHT
            before = character.OriginalCharacter;
#else
            using (StreamReader reader = new StreamReader(character.AbsolutePath))
            {
                before = Character.LoadFromXml(reader.ReadToEnd());                 // load clean version for comparison
            }
#endif
            Character after = character.Character;

            OptimizerResults results = new OptimizerResults(before, after, false);
            results.Closed += (object csender, EventArgs ce) =>
            {
                if (!results.DialogResult.GetValueOrDefault())
                {
                    // we don't want the new character, reload the old one
                    Character _character = character.Character;
                    _character.IsLoading = true;
                    _character.SetItems(before);
                    _character.ActiveBuffs = before.ActiveBuffs;
                    //_character.CurrentTalents = before.CurrentTalents; // let's not play with talents for now
                    _character.IsLoading = false;
                    _character.OnCalculationsInvalidated();
                    character.UnsavedChanges = false;                             // reset the dirty flag and update ui
                }
            };
            //results.SetOptimizerScores(character.Score, character.NewScore.GetValueOrDefault(character.Score));
            results.Show();
        }
예제 #6
0
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            if (optimizer.IsBusy)
            {
                if (lastOperation == Operation.Optimize)
                {
                    optimizer.PauseAsync();
                    var opt = optimizer.GetBestIndividual();
                    if (opt != null)
                    {
                        Character bestCharacter = opt.Character;
                        if (bestCharacter == null)
                        {
                            ControlsEnabled(true);
                            MessageBox.Show("Sorry, Rawr was unable to find a gearset to meet your requirements.", "Rawr Optimizer Results", MessageBoxButton.OK);
                        }

                        if (character != null)
                        {
                            OptimizerResults results = new OptimizerResults(character, bestCharacter, true);
                            results.Closed += new EventHandler(resultsCancel_Closed);
                            results.Show();
                        }
                        else
                        {
                            ControlsEnabled(true);
                        }
                    }
                }
                else
                {
                    optimizer.CancelAsync();
                    PauseButton.Content = "Pause";
                }
            }
        }
예제 #7
0
		private void DiffButton_Click(object sender, RoutedEventArgs e)
		{
#if SILVERLIGHT
			BatchCharacter character = (BatchCharacter)DataGrid.SelectedItem;
#else
			BatchCharacter character = (BatchCharacter)DataGrid.CurrentItem;
#endif
			Character before;
#if SILVERLIGHT
			before = character.OriginalCharacter;
#else
			using (StreamReader reader = new StreamReader(character.AbsolutePath))
			{
				before = Character.LoadFromXml(reader.ReadToEnd()); // load clean version for comparison
			}
#endif
			Character after = character.Character;

			OptimizerResults results = new OptimizerResults(before, after, false);
			results.Closed += (object csender, EventArgs ce) =>
				{
					if (!results.DialogResult.GetValueOrDefault())
					{
						// we don't want the new character, reload the old one
						Character _character = character.Character;
						_character.IsLoading = true;
						_character.SetItems(before);
						_character.ActiveBuffs = before.ActiveBuffs;
						//_character.CurrentTalents = before.CurrentTalents; // let's not play with talents for now
						_character.IsLoading = false;
						_character.OnCalculationsInvalidated();
						character.UnsavedChanges = false; // reset the dirty flag and update ui
					}
				};
			//results.SetOptimizerScores(character.Score, character.NewScore.GetValueOrDefault(character.Score));
			results.Show();
		}
예제 #8
0
        private void optimizer_OptimizeCharacterCompleted(object sender, OptimizeCharacterCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                MaxScoreLabel.Text = string.Empty;
                ControlsEnabled(true);
                AltProgress.Value = MainProgress.Value = 0;
            }
            else
            {
                AltProgress.Value = MainProgress.Value = 100;
                Character bestCharacter = e.OptimizedCharacter;
                if (bestCharacter == null)
                {
                    ControlsEnabled(true);
                    MessageBox.Show("Sorry, Rawr was unable to find a gearset to meet your requirements.", "Rawr Optimizer Results", MessageBoxButton.OK);
                }

                if (character != null)
                {
                    OptimizerResults results = new OptimizerResults(character, bestCharacter, false);
                    results.Closed += new EventHandler(results_Closed);
                    results.Show();
                }
                else ControlsEnabled(true);
            }
        }
예제 #9
0
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            if (optimizer.IsBusy)
            {
                if (lastOperation == Operation.Optimize)
                {
                    optimizer.PauseAsync();
                    var opt = optimizer.GetBestIndividual();
                    if (opt != null)
                    {
                        Character bestCharacter = opt.Character;
                        if (bestCharacter == null)
                        {
                            ControlsEnabled(true);
                            MessageBox.Show("Sorry, Rawr was unable to find a gearset to meet your requirements.", "Rawr Optimizer Results", MessageBoxButton.OK);
                        }

                        if (character != null)
                        {
                            OptimizerResults results = new OptimizerResults(character, bestCharacter, true);
                            results.Closed += new EventHandler(resultsCancel_Closed);
                            results.Show();
                        }
                        else ControlsEnabled(true);
                    }
                }
                else
                {
                    optimizer.CancelAsync();
                    PauseButton.Content = "Pause";
                }
            }
        }