void bViewModel_StatCalcLoadedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { BinomialStatCalcDTO bDto = bViewModel.DataBag; int numerator = 0; int observed = 0; double expected = 0; bool parseResult1 = int.TryParse(txtNumerator.Text, out numerator); bool parseResult2 = int.TryParse(txtObserved.Text, out observed); bool parseResult3 = double.TryParse(txtExpected.Text, out expected); if (parseResult1 && parseResult2 && parseResult3 && numerator < observed) { lblLessThan.Text = "< " + numerator; lblLessThanEqual.Text = "<= " + numerator; lblEqual.Text = "= " + numerator; lblGreaterThanEqual.Text = ">= " + numerator; lblGreaterThan.Text = "> " + numerator; txtLessThan.Text = bDto.LessThanTxt; txtLessThanEqual.Text = bDto.LessThanEqualTxt; txtEqual.Text = bDto.EqualTxt; txtGreaterThanEqual.Text = bDto.GreaterThanEqualTxt; txtGreaterThan.Text = bDto.GreaterThanTxt; txtPValue.Text = bDto.PValueTxt; txt95Ci.Text = bDto.NinefiveCiTxt; } waitCursor.Visibility = System.Windows.Visibility.Collapsed; }
private async void OnEntryDataExFilterExpressionChangetals(object sender, SimpleMvvmToolkit.NotificationEventArgs <string> e) { using (var ctx = new EntryDataExRepository()) { TotalTotal = await ctx.SumNav(e.Data, vloader.NavigationExpression, "Total").ConfigureAwait(false); } }
private void CurrentViewModel_InstallTerminatedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <bool> e) { if (downloadPrompt == null) { return; } EasyTracker.GetTracker().SendEvent("ui_action", "download_install_level_terminated", e.Data.ToString(), 0); Debug.WriteLine("CurrentViewModel_InstallTerminatedEvent"); DownloadPopupContentControl control = (DownloadPopupContentControl)downloadPrompt.Body; if (e.Data == true) { control.SetTitleText(AppResources.PopupLevelsDownloadTerminatedOk); } else { control.SetTitleText(AppResources.PopupLevelsDownloadTerminatedError); } Debug.WriteLine("Launch Timer"); DispatcherTimer dt = new DispatcherTimer(); dt.Interval = TimeSpan.FromSeconds(1.2); dt.Tick += (s, evt) => { downloadPrompt.Hide(); dt.Stop(); }; dt.Start(); }
private void KeyboardControl_IsTitleFoundChanged(object sender, SimpleMvvmToolkit.NotificationEventArgs e) { Debug.WriteLine("Keyboard event : IsTitleFoundChanged"); KeyboardControl keyboardControl = sender as KeyboardControl; if (keyboardControl == null || this.CurrentViewModel == null || this.CurrentViewModel.SelectedMedia == null) { return; } if (keyboardControl.IsFound) { this.CurrentViewModel.CurrentMediaTitleFound(); if (AppSettings.Instance.SoundOnOffSetting) { // Load the SoundEffect var info = App.GetResourceStream(new Uri("Resources/Sounds/success.wav", UriKind.Relative)); SoundEffect effect = SoundEffect.FromStream(info.Stream); // Tell the XNA Libraries to continue to run FrameworkDispatcher.Update(); // Play the Sound effect.Play(); } } //this.CurrentViewModel.SelectedMedia.IsCompleted = keyboardControl.IsFound; //this.CurrentViewModel.ProposerTitre(); }
void vm_ChangeCustomerNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <Core.Model.Order, Core.Model.Customer> e) { bool selected = false; var vm = new CustomerSearchViewModel(); var win = new CustomerSearchView(); win.Owner = Application.Current.MainWindow; win.DataContext = vm; vm.CloseNotice += (ss, ee) => { if (vm.SelectedCustomer != null) { selected = true; e.Completed(vm.SelectedCustomer); } win.Close(); }; win.txtSearch.Focus(); win.ShowDialog(); if (!selected) { e.Completed(null); } }
void vm_SearchProductNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <List <Core.Model.Product>, Core.Model.Product> e) { bool selected = false; var vm = new QuickSearchProductViewModel(e.Data); var win = new SelectProductWindow(); win.Owner = Application.Current.MainWindow; win.DataContext = vm; vm.CloseNotice += (ss, ee) => { if (vm.SelectedProduct != null) { selected = true; e.Completed(vm.SelectedProduct); } win.Close(); }; win.txtSearch.Focus(); win.ShowDialog(); if (!selected) { e.Completed(null); } }
void appMenuViewModel_RecordcountRecievedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { // get the new count this.CurrentDatasourceRecordCount = Convert.ToInt64(this.appMenuViewModel.RecordCountString.Substring(0, this.appMenuViewModel.RecordCountString.IndexOf(","))); if (this.CurrentDatasourceRecordCount != this.CurrentApplicationRecordCount) { // if the DatasourceRecordCount has changed calculate differnece this.RecordCountDifference = Math.Abs(this.CurrentDatasourceRecordCount - this.CurrentApplicationRecordCount); // if auto-reload if (this.ReloadIfChanged) { this.CurrentApplicationRecordCount = this.CurrentDatasourceRecordCount; this.RecordCountDifference = 0; // reload ApplicationViewModel.Instance.ReloadGadgets(); RefreshEvent(this, new EventArgs()); } // amd notify this.DatasourceWatcherEvent(this, new EventArgs()); } }
/// <summary> /// Admins the V m_ test connection completed event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> void adminVM_TestConnectionCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { btnTestConn.IsEnabled = true; //if (e.Message.ToString().ToLower() == "true") if ((bool)sender) { MessageBox.Show("Connection is successful"); btnStep1Next.IsEnabled = true; localDto = new DatasourceDto(); localDto.DatasourceName = tbDSName.Text; //if (rad) //{ //} //localDto.DatasourceConnectionString = con.GetConnectionString(); //localDto.DatasourceType = con.DatabaseType; //localDto.DatabaseName = con.DatabaseName; //localDto.ServerName = con.ServerName; Connection newCon = con; localDto.Connection = newCon; } else { btnStep1Next.IsEnabled = false; MessageBox.Show("Test Connection has failed."); } }
/// <summary> /// Apps the menu view model_ datasources loaded event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> void appMenuViewModel_DatasourcesLoadedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { appMenuViewModel = (AppMenuViewModel)sender; ApplicationViewModel.Instance.EwavDatasources = appMenuViewModel.Datasources2; if (appMenuViewModel.Datasources2.Count > 0) { List <EwavDatasourceDto> Datasources2 = new List <EwavDatasourceDto>(); Datasources2.Insert(0, new EwavDatasourceDto() { DatasourceNoCamelName = "Set Data Source" }); Datasources2.InsertRange(1, appMenuViewModel.Datasources2); //appMenuViewModel.Datasources2 = Datasources2; this.cboDatasoures.ItemsSource = Datasources2; this.cboDatasoures.SelectedValue = "DatasourceID"; this.cboDatasoures.DisplayMemberPath = "DatasourceNoCamelName"; this.cboDatasoures.SelectedIndex = 0; } else { spMsg.Visibility = System.Windows.Visibility.Visible; tbSaveError.Text = "There are no data sources assigned to you. Please contact the Adminstrator for your organization."; btnSetDB.IsEnabled = false; } waitCursor.Visibility = System.Windows.Visibility.Collapsed; }
private void CurrentViewModel_InstallLevelStartEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs e) { //downloadPrompt = MessagePromptHelper.GetNewMessagePromptWithNoTitle(); //downloadPrompt.IsAppBarVisible = false; //downloadPrompt.IsCancelVisible = false; //downloadPrompt.ActionPopUpButtons.Clear(); //downloadPrompt.Message = AppResources.PopupLevelsDownloadMessage; //downloadPrompt.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center; //downloadPrompt.VerticalContentAlignment = System.Windows.VerticalAlignment.Center; //downloadPrompt.VerticalAlignment = System.Windows.VerticalAlignment.Center; //downloadPrompt.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; //var progressBar = new ProgressBar(); //progressBar.IsEnabled = true; //progressBar.Value = 0; //downloadPrompt.Body = progressBar; //downloadPrompt.Show(); Debug.WriteLine("CurrentViewModel_InstallLevelStartEvent"); // We show the "about" app info downloadPrompt = MessagePromptHelper.GetNewMessagePromptWithNoTitleAndWhiteStyle(); downloadPrompt.VerticalContentAlignment = System.Windows.VerticalAlignment.Center; downloadPrompt.VerticalAlignment = System.Windows.VerticalAlignment.Center; var body = new DownloadPopupContentControl(); body.ProgressBar.Visibility = System.Windows.Visibility.Visible; body.PercentTextblock.Visibility = System.Windows.Visibility.Visible; body.SetTitleText(AppResources.PopupLevelsDownloadMessage); // Prompt if sure of reinit downloadPrompt.ActionPopUpButtons.Clear(); downloadPrompt.Body = body; downloadPrompt.Show(); }
/// <summary> /// Advm_s the read completed event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> void advm_ReadCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { List <DTO.DatasourceDto> users = (List <DTO.DatasourceDto>)sender; availableList = new ObservableCollection <DTO.DatasourceDto>(users); ReadRestOfAvailableDatasources(selectedList); BindListBoxes(); }
private void keyboardControl_HelpNotAvailableYet(object sender, SimpleMvvmToolkit.NotificationEventArgs <DateTime> e) { EasyTracker.GetTracker().SendEvent("game_event", "help_notavailable", this.CurrentViewModel.SelectedMedia.Title, this.CurrentViewModel.SelectedMedia.Id); TimeSpan nbSeconds = e.Data - DateTime.Now; var text = AppResources.GamePageHelpPopupText.Replace("#time", ((int)nbSeconds.TotalSeconds).ToString()); MessageBox.Show(text, AppResources.GamePageHelpPopupTitle, MessageBoxButton.OK); }
/// <summary> /// Admins the V m_ read associated users completed event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> void adminVM_ReadAssociatedUsersCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { List <UserDTO> Users = (List <UserDTO>)sender; selectedList = new ObservableCollection <UserDTO>(Users.Where(t1 => t1.UserID != User.Instance.UserDto.UserID && t1.UserRoleInOrganization.ToLower() == "analyst")); ReadAllUsers(); }
void bViewModel_ErrorNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { if (e.Data.Message.Length > 0) { ChildWindow window = new ErrorWindow(e.Data); window.Show(); //return; } }
private async void OnOversShortsFilterExpressionChangetals(object sender, SimpleMvvmToolkit.NotificationEventArgs <string> e) { using (var ctx = new OversShortEXRepository()) { TotalReceivedValue = await ctx.SumNav(e.Data, vloader.NavigationExpression, "ReceivedValue").ConfigureAwait(false); TotalInvoiceValue = await ctx.SumNav(e.Data, vloader.NavigationExpression, "InvoiceValue").ConfigureAwait(false); } }
//public SaveDash(string message) //{ // InitializeComponent(); // applicationViewModel.SaveCanvasCompletedEvent += new Client.Application.SaveCanvasCompletedEventHandler(applicationViewModel_SaveCanvasCompletedEvent); void applicationViewModel_ErrorNoticeEvent(SimpleMvvmToolkit.NotificationEventArgs <Exception> o) { spMsg.Visibility = System.Windows.Visibility.Visible; if (o.Data != null) { tbSaveError.Text = o.Data.Message; } }
void AdminDSVM_ErrorNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { spMsg.Visibility = System.Windows.Visibility.Visible; imgSMsg.Visibility = System.Windows.Visibility.Collapsed; imgerrMsg.Visibility = System.Windows.Visibility.Visible; errMsg.Visibility = System.Windows.Visibility.Visible; errMsg.Text = (e.Data).Message; spMsg.Background = new SolidColorBrush(Color.FromArgb(255, 241, 202, 194)); //pink BK to use in case of error errMsg.Foreground = new SolidColorBrush(Color.FromArgb(255, 96, 25, 25)); //dark pink text color to use in case of error. }
void statcalcViewModel_ErrorNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { if (e.Data.Message.Length > 0) { ChildWindow window = new ErrorWindow(e.Data); window.Show(); //return; } this.SetGadgetToFinishedState(); }
void adminVM_ReadEweFormIdCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { if (sender == null || sender.ToString() == string.Empty) { MessageBox.Show("Epi Info Form project couldnt be found in the system. Contact your system administrator"); return; } else { NavigateToStep2(); } }
private void CurrentViewModel_DownloadProgressEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <int> e) { if (downloadPrompt == null) { return; } Debug.WriteLine("CurrentViewModel_DownloadProgressEvent"); DownloadPopupContentControl control = (DownloadPopupContentControl)downloadPrompt.Body; control.SetPercentProgress(e.Data); //downloadPrompt.Message = e.Data.ToString(); }
/// <summary> /// Admins the V m_ add completed event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> void adminVM_AddCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { HideShowErrMessage(sender); if ((bool)sender) { RequestRead(); this.DialogResult = true; } //else //{ // this.DialogResult = false; //} }
private void PopupSplashViewModel_NoNetworkAlert(object sender, SimpleMvvmToolkit.NotificationEventArgs e) { MessagePrompt helpPrompt = MessagePromptHelper.GetNewMessagePromptWithNoTitle(); helpPrompt.IsAppBarVisible = true; helpPrompt.IsCancelVisible = false; helpPrompt.Message = AppResources.InitNoNetworkMessage; Button button = new Button(); button.Content = "Ok"; helpPrompt.Show(); }
/// <summary> /// Admins the V m_ test data completed event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> void adminVM_TestDataCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { btnTestData.IsEnabled = true; if (((bool)sender)) { MessageBox.Show("Successfully Tested data"); btnStep2Next.IsEnabled = true; } else { btnStep2Next.IsEnabled = false; MessageBox.Show("Test Data has failed."); } }
private void CurrentViewModel_LongLoadingStartEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs e) { systemTrayVisibleBck = SystemTray.IsVisible; SystemTray.Opacity = 0.3; SystemTray.BackgroundColor = Colors.Transparent; SystemTray.SetIsVisible(this, true); ProgressIndicator prog = new ProgressIndicator(); prog.IsVisible = true; prog.IsIndeterminate = true; prog.Text = AppResources.LoadingIndicator; SystemTray.SetProgressIndicator(this, prog); }
/// <summary> /// Admins the V m_ read completed event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> void adminVM_ReadCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { var dto = sender as List <DatasourceDto>; if (applicationViewModel.DemoMode) { foreach (DatasourceDto item in dto) { item.Connection.ServerName = "<server name withheld> "; } } dgDataSource.Refresh(dto); }
private void CurrentViewModel_InstallFilesProgress(object sender, SimpleMvvmToolkit.NotificationEventArgs <int> e) { if (downloadPrompt == null) { return; } Debug.WriteLine("CurrentViewModel_InstallFilesProgress"); DownloadPopupContentControl control = (DownloadPopupContentControl)downloadPrompt.Body; control.SetTitleText(AppResources.PopupLevelsDownloadInstallationProgress); control.SetPercentProgress(e.Data); //control.PercentTextblock.Visibility = System.Windows.Visibility.Collapsed; //control.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; }
void vm_ManagePurchaseNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <Core.Model.Purchase> e) { var vm = new ManagePurchaseViewModel(e.Data); vm.ErrorNotice += (ss, ee) => { MessageBox.Show(ee.Message, "ERROR", MessageBoxButton.OK); }; var win = new ManagePurchaseWindow(); win.DataContext = vm; win.Owner = Application.Current.MainWindow; win.Show(); // show non-blocking }
private void keyboardControl_BadWord(object sender, SimpleMvvmToolkit.NotificationEventArgs e) { if (AppSettings.Instance.SoundOnOffSetting == false) { return; } // Load the SoundEffect var info = App.GetResourceStream(new Uri("Resources/Sounds/wrong.wav", UriKind.Relative)); SoundEffect effect = SoundEffect.FromStream(info.Stream); // Tell the XNA Libraries to continue to run FrameworkDispatcher.Update(); // Play the Sound effect.Play(); }
void vm_PreviewNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <Core.Model.Order> e) { try { var flowDocument = PrintHelper.GetPrintDocument(e.Message, e.Data); var xps = PrintHelper.GetXpsDocument(flowDocument); var document = xps.GetFixedDocumentSequence(); var previewWindow = new PreviewTicket(); previewWindow.Owner = Application.Current.MainWindow; previewWindow.docViewer.Document = document; previewWindow.ShowDialog(); } catch (Exception ex) { LogService.Error("Error while preview ticket", ex); MessageBox.Show(ex.Message); } }
/// <summary> /// Admins the V m_ read users completed event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> void adminVM_ReadUsersCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e) { if (sender != null) { OriginalList = new ObservableCollection <UserDTO>((List <UserDTO>)sender); availableList = new ObservableCollection <UserDTO>(OriginalList.Where(t1 => t1.UserID != User.Instance.UserDto.UserID && t1.UserRoleInOrganization.ToLower() == "analyst")); //take the logged in user and admins out the list if (SelectedDatasourceDto != null) { ReadRestOfAvailableUsers(selectedList); } BindListBoxes(); } else { btnStep1Next.IsEnabled = false; } }