public LoaderWindowViewModel(LoaderWindow window, int timerInterval) { if (window == null) throw new ArgumentNullException("Null window in ctor"); if (timerInterval <= 0) throw new ArgumentOutOfRangeException("Erro timerInterval value in ctor"); this.window = window; this.timerInterval = timerInterval; this.currentEllipseNumber = MIN_ELLIPSE_NUMBER + 1; this.Timer = new System.Windows.Forms.Timer(); this.Timer.Interval = this.timerInterval; this.Timer.Tick += this.RecolorEllipse; this.Ellipse_1_Brush = darkBrush; this.Ellipse_2_Brush = lightBrush; this.Ellipse_3_Brush = lightBrush; this.Ellipse_4_Brush = lightBrush; this.Ellipse_5_Brush = lightBrush; this.Ellipse_6_Brush = lightBrush; this.Ellipse_7_Brush = lightBrush; this.Ellipse_8_Brush = lightBrush; this.Ellipse_9_Brush = lightBrush; this.Ellipse_10_Brush = lightBrush; this.Ellipse_11_Brush = lightBrush; this.Ellipse_12_Brush = lightBrush; this.Ellipse_13_Brush = lightBrush; this.Ellipse_14_Brush = lightBrush; this.Ellipse_15_Brush = lightBrush; this.Ellipse_16_Brush = lightBrush; }
/// <summary> /// Запуск загрузчика /// </summary> /// <param name="textInfromation">Текстовое сообщение</param> private void StartLoader(string textInfromation) { try { this.window.Dispatcher.BeginInvoke(new Action(() => { loaderWindow = new LoaderWindow(); loaderWindow.Show(); LoaderWindowViewModel loaderWindowViewModel = (LoaderWindowViewModel)loaderWindow.DataContext; loaderWindowViewModel.TextInformation = textInfromation; loaderWindowViewModel.StartAnimation(); })); } catch (Exception exception) { this.ShowExceptionMessage(exception.Message); } }