Exemple #1
0
        private void RefreshCounters(ModelControl control)
        {
            if ((control.DataContext as Experiment).Data.IsCountersEvaluationEnabled)
            {
                if (AreCountersGlobalVisible)
                {
                    control.OpenCountersGrid();

                    if (!control.HasPoints || !control.HasCounters)
                    {
                        if (bigShadow.Shadow == null)
                        {
                            bigShadow.ShowThis(new LoadingControl("Drawing counters..."));
                            bigShadow.ShadowUp();
                        }

                        ThreadPool.QueueUserWorkItem(o =>
                        {
                            aex.Protect(() =>
                            {
                                if (!control.HasPoints)
                                {
                                    OnDrawPoints(control);
                                }
                                if (!control.HasCounters)
                                {
                                    OnDrawCounters(control);
                                }

                                control.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate()
                                {
                                    bigShadow.ShadowDown();
                                }));
                            });
                        });
                    }

                    if (!control.ArePointsVisible || !control.AreCountersVisible)
                    {
                        if (!control.ArePointsVisible)
                        {
                            control.ChangePointsVisibility(Visibility.Visible);
                        }
                        if (!control.AreCountersVisible)
                        {
                            control.ChangeCountersVisibility(Visibility.Visible);
                        }
                    }
                }
                else
                {
                    control.CloseCountersGrid();

                    if (control.ArePointsVisible || control.AreCountersVisible)
                    {
                        if (control.ArePointsVisible)
                        {
                            control.ChangePointsVisibility(Visibility.Hidden);
                        }
                        if (control.AreCountersVisible)
                        {
                            control.ChangeCountersVisibility(Visibility.Hidden);
                        }
                    }
                }
            }
        }