Exemple #1
0
        private void AsyncCalculationCompleted(object arg)
        {
            AsyncCalculationResult result = (AsyncCalculationResult)arg;

            if (result.DisplayCalculationValues != null && result.Calculations == referenceCalculation)
            {
                CalculationDisplay.SetCalculations(result.DisplayCalculationValues);
                // refresh chart
                ComparisonGraph.UpdateGraph();
                asyncCalculation = null;
            }
        }
Exemple #2
0
        public void character_CalculationsInvalidated(object sender, EventArgs e)
        {
#if DEBUG
            DateTime start = DateTime.Now;
#endif
            this.Cursor = Cursors.Wait;
            if (asyncCalculation != null)
            {
                CharacterCalculationsBase oldCalcs = referenceCalculation;
                referenceCalculation = null;
                oldCalcs.CancelAsynchronousCharacterDisplayCalculation();
                asyncCalculation = null;
            }
            //_unsavedChanges = true;
            referenceCalculation = Calculations.GetCharacterCalculations(character, null, true, true, true);
            CalculationDisplay.SetCalculations(referenceCalculation.GetCharacterDisplayCalculationValues());
            UpdateDisplayCalculationValues(referenceCalculation.GetCharacterDisplayCalculationValues(), referenceCalculation);
            if (Character.PrimaryProfession == Profession.Blacksmithing || Character.SecondaryProfession == Profession.Blacksmithing)
            {
                //HandBSCheck.IsChecked = true;
                //WristBSCheck.IsChecked = true;
                HandBSCheck.IsEnabled  = true;
                WristBSCheck.IsEnabled = true;
            }
            else
            {
                HandBSCheck.IsChecked  = false;
                WristBSCheck.IsChecked = false;
                HandBSCheck.IsEnabled  = false;
                WristBSCheck.IsEnabled = false;
            }
            if (referenceCalculation.RequiresAsynchronousDisplayCalculation)
            {
                asyncCalculation = AsyncOperationManager.CreateOperation(null);
                ThreadPool.QueueUserWorkItem(delegate
                {
                    AsyncCalculationStart(referenceCalculation, asyncCalculation);
                });
            }
            this.Cursor = Cursors.Arrow;
#if DEBUG
            System.Diagnostics.Debug.WriteLine(string.Format("Finished MainPage CalculationsInvalidated: {0}ms", DateTime.Now.Subtract(start).TotalMilliseconds));
#endif
        }