Exemplo n.º 1
0
        private void CompareCharacters_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "character file (*.xml)|*.xml";
            if (ofd.ShowDialog().GetValueOrDefault(false))
            {
#if SILVERLIGHT
                using (StreamReader reader = ofd.File.OpenText())
#else
                using (StreamReader reader = new StreamReader(ofd.OpenFile()))
#endif
                {
                    Character newCharacter = Character.LoadFromXml(reader.ReadToEnd());
                    OptimizerResults or = new OptimizerResults(Character, newCharacter, false);
                    // Set up the Dialog, its not supposed to look the same as an actual Optimizer Results
                    or.BT_StoreIt.Visibility = Visibility.Collapsed;
                    or.Title = "Comparing Current Character to Another";
                    or.CancelButton.Visibility = Visibility.Collapsed;
                    or.OKButton.Content = "OK";
                    or.OptimizedScoreLabel.Text = string.Format("Other Character: {0}", or.optimizedCalc.OverallPoints);
                    //
                    or.Show();
                }
                _unsavedChanges = false;
            }
        }
Exemplo n.º 2
0
 private void CompareItemSet_Confirmation(object sender, EventArgs e) {
     if ((sender as DG_ItemSetNameToCompare).DialogResult.GetValueOrDefault(false)) {
         Character newCharacter = Character.Clone();
         newCharacter.EquipItemSetByName((sender as DG_ItemSetNameToCompare).SetNameToEquip);
         OptimizerResults or = new OptimizerResults(Character, newCharacter, false);
         // Set up the Dialog, its not supposed to look the same as an actual Optimizer Results
         or.BT_StoreIt.Visibility = Visibility.Collapsed;
         or.Title = "Comparing Currently Equipped Set to Other Set";
         or.OKButton.Content = "Equip Other Set";
         or.OptimizedScoreLabel.Text = string.Format("Other Set: {0}", or.optimizedCalc.OverallPoints);
         //
         or.Closed += new EventHandler(CompareItemSetEquip_Confirmation);
         or.Show();
     }
 }