private void Decode(MouseEventArgs e) { var content = _editorManager.GetValue(); if (string.IsNullOrEmpty(content)) { Toaster.Add("Content is empty", MatToastType.Warning); return; } if (_model.SelectedFileSpecId == -1) { Toaster.Add("A file definition must be selected", MatToastType.Warning); return; } var getFileSpecificationResult = FileSpecificationsStore.GetFileSpecificationById(_model.SelectedFileSpecId); if (!getFileSpecificationResult.Succeed) { Toaster.Add(getFileSpecificationResult.Message, MatToastType.Warning); return; } DecodeContent(content, getFileSpecificationResult.Data.Content); }
private async void Btn_saveReportlang_Click(object sender, RoutedEventArgs e) { // string msg = ""; int msg = 0; if (cb_reportlang.SelectedIndex != -1) { replangrow = replangList.Where(r => r.valId == (int)cb_reportlang.SelectedValue).FirstOrDefault(); replangrow.isDefault = 1; msg = await setvalueModel.Save(replangrow); // replangrow.valId= await MainWindow.GetReportlang(); await fillRepLang(); if (msg > 0) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } } }
public int SetToasts(int numToasts) { if (numToasts > 2) { throw new Exception("The maximum number of toasts is 2."); } Toaster toaster = db.Toasters.FirstOrDefault(); PantryController pantry = new PantryController(); if (pantry.HowManyBreads() >= 0) { toaster.NumToasts = pantry.GetBreads(numToasts); } db.Entry(toaster).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { throw; } return(toaster.NumToasts); }
static async public void ExceptionMessage(Exception ex, object window) { try { //Message if (ex.HResult == -2146233088) { Toaster.ShowError(window as Window, message: "trNoConnection", animation: ToasterAnimation.FadeIn); } else { Toaster.ShowError(window as Window, message: ex.HResult + " || " + ex.Message, animation: ToasterAnimation.FadeIn); } //ErrorClass errorClass = new ErrorClass(); //errorClass.num = ex.HResult.ToString(); //errorClass.msg = ex.Message; //errorClass.stackTrace = ex.StackTrace; //errorClass.targetSite = ex.TargetSite.ToString(); //errorClass.posId = MainWindow.posID; //errorClass.branchId = MainWindow.branchID; //errorClass.createUserId = MainWindow.userLogin.userId; //await errorClass.save(errorClass); } catch { } }
public MainWindow() { InitializeComponent(); bool createdNew; Mutex = new Mutex(true, appName, out createdNew); if (!createdNew) { Environment.Exit(0); } String[] cla = Environment.GetCommandLineArgs(); if (cla.Length != 3) { Environment.Exit(0); } this.Hide(); Toaster toaster = new Toaster(); toaster.Show(cla[1], new Exception(cla[2])); }
private async Task openCloseBox(string status) { CashTransfer cashTransfer = new CashTransfer(); cashTransfer.processType = "box"; cashTransfer.transType = status; cashTransfer.cash = MainWindow.posLogIn.balance; cashTransfer.createUserId = MainWindow.userID.Value; cashTransfer.posId = (int)MainWindow.posID; if (status == "o") { cashTransfer.transNum = await cashTransfer.generateCashNumber("bc"); } else { cashTransfer.transNum = await cashTransfer.getLastOpenTransNum((int)MainWindow.posID); } int res = await posModel.updateBoxState((int)MainWindow.posID, status, Convert.ToInt32(isAdmin), MainWindow.userLogin.userId, cashTransfer); if (res > 0) { await MainWindow.refreshBalance(); Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopUpdate"), animation: ToasterAnimation.FadeIn); } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } }
private async void Btn_update_Click(object sender, RoutedEventArgs e) {//update try { if (sender != null) { SectionData.StartAwait(grid_main); } if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "update") || SectionData.isAdminPermision()) { if (unit.unitId > 0) { //validate values validateEmptyValues(); if (!tb_name.Text.Equals("")) { // check if new unit doesn't match old units var unitObj = units.ToList().Find(x => x.name == tb_name.Text); if (unitObj is null || unitObj.name == unit.name) { unit.name = tb_name.Text; unit.notes = tb_notes.Text; int res = await unitModel.save(unit); if (res > 0) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopUpdate"), animation: ToasterAnimation.FadeIn); } else { Toaster.ShowError(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } await RefreshUnitsList(); Tb_search_TextChanged(null, null); } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorDuplicateUnitNameToolTip"), animation: ToasterAnimation.FadeIn); } } } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trSelectItemFirst"), animation: ToasterAnimation.FadeIn); } } else { Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn); } if (sender != null) { SectionData.EndAwait(grid_main); } }
public async Task HandleValidSubmitAsync() { await FileUploadService.UploadAsync(file, Model.FileGuid); var plugin = PluginTester.LoadPlugin(Model.FileGuid); if (plugin == null) { Toaster.Error("Vložený soubor není platná knihovna."); return; } try { PluginTester.TestImplementation(plugin); } catch (Exception e) { Toaster.Error(e.Message, "Chyba implementace"); return; } await PlayerService.InsertNewPlayerAsync(new PlayerVM { Name = Model.Name, Password = Model.Password, FileGuid = Model.FileGuid, League = (League)Convert.ToInt32(Model.League) }); Toaster.Info("Nový hráč vložen."); NavigationManager.NavigateTo("/players"); }
protected void ShowToastSuccess(string sMessage) { Toaster.Add(sMessage, MatToastType.Success, "", "", config => { config.VisibleStateDuration = 2000; }); }
protected async Task Save() { await DataService.CustomFields.SaveCustomValue(SocialKey, SocialValue); StateHasChanged(); Toaster.Success("Updated"); }
async Task AddAccount() { newUserDialogIsOpen = false; var newUser = ldapUsers.FirstOrDefault(u => u.UserName == LdapUser.UserName); // Remove from dropdown list of LdapUsers collection ldapUsers.Remove(newUser); var jsonContent = JsonConvert.SerializeObject(newUser); var buffer = System.Text.Encoding.UTF8.GetBytes(jsonContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); var response = await HttpClient.PostAsync("api/account/identity/add", byteContent); var content = await response.Content.ReadAsStringAsync(); //Add to UsersIdentity collection var appUserIdentity = JsonConvert.DeserializeObject <AppUserIdentity>(content); appUsersList.Add(appUserIdentity.AssosiatedUser); appUsersList = appUsersList.OrderBy(d => d.DisplayName).ToList(); Toaster.Add($"Пользователь успешно добавлен в систему", MatToastType.Success, "Успех!"); LdapUser = new LdapUser(); }
public MainWindow() { InitializeComponent(); // load default personal settings this.Width = Properties.Settings.Default.lastWidth; this.Height = Properties.Settings.Default.lastHeight; // first Init dbPassword = new DataBase <tbl_Password>(); dbSetting = new DataBase <tbl_Setting>(); _Toaster = new Toaster(); isProtectionEnable(); loadData(); loadSetting(); // display cardShow in default menuShow_Click(null, null); // fill colors comboBox comboColor.ItemsSource = Enum.GetValues(typeof(card.myColors)).Cast <card.myColors>(); // set default Value comboColor.SelectedIndex = 0; }
private async void Btn_refresh_Click(object sender, RoutedEventArgs e) { try { if (sender != null) { SectionData.StartAwait(grid_main); } if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "show") || SectionData.isAdminPermision()) { await RefreshSectionsList(); Tb_search_TextChanged(null, null); } else { Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn); } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }
static async public void ExceptionMessage(Exception ex, object window) { try { //Message if (ex.HResult == -2146233088) { Toaster.ShowError(window as Window, message: MainWindow.resourcemanager.GetString("trNoInternetConnection"), animation: ToasterAnimation.FadeIn); } else { Toaster.ShowError(window as Window, message: ex.HResult + " || " + ex.Message, animation: ToasterAnimation.FadeIn); } ErrorClass errorClass = new ErrorClass(); errorClass.num = ex.HResult.ToString(); errorClass.msg = ex.Message; errorClass.stackTrace = ex.StackTrace; errorClass.targetSite = ex.TargetSite.ToString(); errorClass.createUserId = MainWindow.userLogin.userId; await errorClass.Save(errorClass); } catch { } }
private async Task addInventory(string invType) { if (inventory.inventoryId == 0) { inventory.branchId = MainWindow.branchID.Value; inventory.posId = MainWindow.posID.Value; inventory.createUserId = MainWindow.userLogin.userId; } if (invType == "n") { inventory.num = await inventory.generateInvNumber("in", MainWindow.branchID.Value); } inventory.inventoryType = invType; inventory.updateUserId = MainWindow.userLogin.userId; int inventoryId = await inventory.save(inventory); if (inventoryId != 0) { // add inventory details int res = await invItemModel.save(invItemsLocations, inventoryId); Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAdd"), animation: ToasterAnimation.FadeIn); clearInventory(); } else { Toaster.ShowError(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } }
private bool validateDistroy() { bool valid = true; SectionData.validateEmptyTextBox(tb_reasonOfDestroy, p_errorReasonOfDestroy, tt_errorReasonOfDestroy, "trEmptyReasonToolTip"); if (tb_reasonOfDestroy.Text.Equals("")) { valid = false; return(valid); } if (invItemLoc == null || invItemLoc.id == 0) { SectionData.validateEmptyComboBox(cb_item, p_errorItem, tt_errorItem, "trEmptyItemToolTip"); SectionData.validateEmptyComboBox(cb_unit, p_errorUnit, tt_errorUnit, "trErrorEmptyUnitToolTip"); if (cb_item.SelectedIndex == -1 || cb_unit.SelectedIndex == -1) { valid = false; return(valid); } } if (int.Parse(tb_amount.Text) < lst_serials.Items.Count) { valid = false; Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorSerialMoreItemCountToolTip"), animation: ToasterAnimation.FadeIn); } return(valid); }
private async Task <bool> validateInputs() { bool valid = true; SectionData.validateEmptyTextBox(tb_fromQuantity, p_errorFromQuantity, tt_errorFromQuantity, "trEmptyQuantityToolTip"); SectionData.validateEmptyComboBox(cb_toUnit, p_errorToUnit, tt_errorToUnit, "trErrorEmptyDesUnitToToolTip"); SectionData.validateEmptyComboBox(cb_fromUnit, p_errorFromUnit, tt_errorFromUnit, "trErrorEmptySrcUnitToolTip"); if (tb_fromQuantity.Text.Equals("") || cb_fromUnit.SelectedIndex == -1 || cb_toUnit.SelectedIndex == -1) { valid = false; return(valid); } int quantity = int.Parse(tb_fromQuantity.Text); if (cb_sectionLocation.SelectedIndex == -1) { int branchQuantity = await ItemLocation.getUnitAmount((int)cb_fromUnit.SelectedValue, MainWindow.branchID.Value); if (branchQuantity < quantity) { tb_fromQuantity.Text = branchQuantity.ToString(); //setToquantityMessage(); Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorAmountNotAvailableFromToolTip"), animation: ToasterAnimation.FadeIn); valid = false; return(valid); } } if (isSmall == null && _ConversionQuantity > quantity) { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorNoEnoughQuantityToolTip"), animation: ToasterAnimation.FadeIn); valid = false; return(valid); } return(valid); }
protected void ShowToastWarning(string sMessage) { Toaster.Add(sMessage, MatToastType.Warning, "", "", config => { config.VisibleStateDuration = 5000; }); }
private bool IsAssemblyValid() { AssemblyLoadContext assemblyLoadContext = new CollectibleAssemblyLoadContext(); try { Assembly plugin; try { plugin = PluginTester.LoadPlugin(assemblyLoadContext, Model.FileGuid); } catch (Exception e) { Toaster.Error($"Vložený soubor není platná knihovna. ({e.Message})"); return(false); } try { PluginTester.TestImplementation(plugin); } catch (Exception e) { Toaster.Error(e.Message, "Chyba implementace"); return(false); } } finally { assemblyLoadContext.Unload(); } return(true); }
private void Btn_pieChart_Click(object sender, RoutedEventArgs e) { try { if (sender != null) { SectionData.StartAwait(grid_main); } if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "report") || SectionData.isAdminPermision()) { } else { Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn); } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }
protected async Task DeletePlayerAsync() { if (string.IsNullOrEmpty(DeletePassword)) { Toaster.Error("Zadejte prosím heslo pro smazání."); return; } modalRef.Hide(); if (DeletePlayerId == null) { return; } try { await PlayerService.DeleteAsync(DeletePlayerId.Value, DeletePassword); } catch (Exception e) { Toaster.Error(e.Message); return; } DeletePlayerId = null; Toaster.Info("Hráč byl smazán."); await OnParametersSetAsync(); }
private async void deleteRowFromInvoiceItems(object sender, RoutedEventArgs e) { try { if (sender != null) { SectionData.StartAwait(grid_ucInvoice); } for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual) { if (vis is DataGridRow) { #region Window.GetWindow(this).Opacity = 0.2; wd_acceptCancelPopup w = new wd_acceptCancelPopup(); w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxDelete"); w.ShowDialog(); Window.GetWindow(this).Opacity = 1; #endregion if (w.isOk) { Invoice row = (Invoice)dg_Invoice.SelectedItems[0]; int res = 0; if (row.invType == "or") { res = await invoice.deleteOrder(row.invoiceId); } else { res = await invoice.deleteInvoice(row.invoiceId); } if (res > 0) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopDelete"), animation: ToasterAnimation.FadeIn); await refreshInvoices(); Txb_search_TextChanged(null, null); } else { Toaster.ShowError(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } } } } if (sender != null) { SectionData.EndAwait(grid_ucInvoice); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_ucInvoice); } SectionData.ExceptionMessage(ex, this); } }
private async Task Prihlasit(OsobaDto neprihlaseny) { // pokud kliknu na přihlášení a následně na změnu termínu, dojde // - ke spuštění volání API pro přihlášení // - k nastavení State.Prihlaseni na null // - a k spuštění volní API pro načtení detailů termínu. // Pokud dojde k dokončení přihlášení před načtením termínu, je již State.Prihlaseni a State.Neprihlaseni null. // Pokud dokde k dokončení přihlášení po načtení termíu, jsou ve State.Prihlaseni a State.Neprihlaseni hodnoty nového termínu. // Takže nemůžeme volat Add/Remove nad State.Prihlaseni. Potřebujeme je volat nad kolekcemi platnými před spuštěním přihlašování. var prihlaseni = State.Prihlaseni; var neprihlaseni = State.Neprihlaseni; await Progress.ExecuteInProgressAsync(async() => await TerminWebApiClient.PrihlasitAsync(State.AktualniTerminId.Value, neprihlaseny.Id)); if (!prihlaseni.Contains(neprihlaseny)) { prihlaseni.Add(neprihlaseny); } neprihlaseni.Remove(neprihlaseny); Toaster.Success($"{neprihlaseny.PrijmeniJmeno} přihlášen(a)."); await LocalStorageService.SetItemAsync("PrefferedOsobaId", neprihlaseny.Id); PrefferedOsobaId = neprihlaseny.Id; }
private void Btn_addRange_Click(object sender, RoutedEventArgs e) { try { if (sender != null) { SectionData.StartAwait(grid_main); } if (MainWindow.groupObject.HasPermissionAction(addRangePermission, MainWindow.groupObjects, "one") || SectionData.isAdminPermision()) { Window.GetWindow(this).Opacity = 0.2; wd_locationAddRange w = new wd_locationAddRange(); w.ShowDialog(); Window.GetWindow(this).Opacity = 1; Btn_refresh_Click(null, null); } else { Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn); } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }
protected void SaveCustom() { if (string.IsNullOrEmpty(CurrentField.Name) || string.IsNullOrEmpty(CurrentField.Content)) { Toaster.Error("Name and content required"); } else { try { var existing = DataService.CustomFields.Single( f => f.AuthorId == Author.Id && f.Name == CurrentField.Name); if (existing == null) { DataService.CustomFields.Add(CurrentField); DataService.Complete(); CurrentField = new CustomField { AuthorId = Author.Id, Name = "", Content = "" }; } Toaster.Success(Localizer["completed"]); } catch (Exception ex) { Toaster.Error(ex.Message); } } }
// Attribute specifying to routing layer that PUT is intended (http verb public IActionResult Update(string id, Toaster toasterIn) // IAction Result is preferable here to ActionResult since the update // could result in multiple ActionResult return types. // the Put action does the responding, the actionResult method chooses // what kind of response { // model binding is going on here. retrieving/providing/converting/updating // data is automated for the action var toaster = _toasterService.Get(id); if (toaster == null) { return(NotFound()); } var oldToaster = _toasterService.Get(id); _toasterService.Update(id, toasterIn); // running toaster lookup and update with most recent info for log // NOTE: it is logically possible for the toaster state to be updated in the DB // and still have the logging fail. This is something we can handle in the next iteration. EventHandler.HandleToasterStateChange(oldToaster, toasterIn); // call logging HandleToaster... function from EventHandler to log // the event return(NoContent()); }
protected async Task ChangePwd() { try { if (await FeatureManager.IsEnabledAsync(nameof(AppFeatureFlags.Demo))) { Toaster.Error("Running in demo mode - change password disabled"); } else { var authState = await AuthenticationStateTask; var user = await UserManager.GetUserAsync(authState.User); var result = await UserManager.ChangePasswordAsync(user, PwdModel.OldPassword, PwdModel.NewPassword); if (!result.Succeeded) { Toaster.Error("Error changing password"); } else { Toaster.Success(Localizer["saved"]); } } } catch (Exception ex) { Toaster.Error(ex.Message); } }
private void Start() { Instance = this; gameObject.SetActive(false); backgroundStartingAlpha = background.color.a; textStartingAlpha = textMesh.color.a; }
private async void SaveChanges() { bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to save changes?"); if (confirmed) { FormatRunTimeFields(); try { await RunTimeParameterService.UpdateRunTimesForJob(results); Toaster.Add("Run Time Changes Saved Successfully", MatToastType.Success, "Success", "✓"); await GetData(); Modal.Close(ModalResult.Ok(results)); } catch (Exception ex) { Toaster.Add("Error Saving Run Time Changes, try again.", MatToastType.Danger, "Warning", "⚠"); Console.WriteLine("Error saving run time changes", ex.Message); } } }
async Task SubmitUnlock() { _submitIcon = "hourglass_empty"; _submitIconClass = "icon-spinning"; _submitText = "Unlocking..."; _submitDisabled = true; StateHasChanged(); try { await App.BW.Unlock(Password); Toaster.Add("Unlocked!", MatToastType.Success, "Unlock"); Nav.NavigateTo("vault"); } catch (Exception ex) { ShowError(ex); } finally { _submitIcon = "lock_open"; _submitIconClass = ""; _submitText = "Sign In"; _submitDisabled = false; StateHasChanged(); } }
void Start() { Toaster T = new Toaster(); T.ThingName = "Talkie"; print(T.ThingName); Zombie Z = (Zombie)gameObject.AddComponent<Zombie>(); Z.ThingName = "Stubbs"; print(Z.ThingName); }
void Awake() { instance = this; }