protected override void MoveNext() { // Create OpenFileDialog SaveFileDialog dlg = new SaveFileDialog(); // Set filter for file extension and default file extension dlg.DefaultExt = ".conf"; // Display OpenFileDialog by calling ShowDialog method bool?result = dlg.ShowDialog(); // Get the selected file name and display in a TextBox if (result == true) { try { builder.SaveSettings(dlg.FileName); } catch (Exception e) { MessageBoxWrapper.Show(e.Message); } } }
protected override void Delete() { if (Lookup != null) { if ((this.CurrentRowIndex == -1)) { return; } if (MessageBoxWrapper.Show("Сигурни ли сте, че желаете да изтриете този запис?", "Предупреждение", MessageBoxWrapperButton.YesNo) == MessageBoxWrapperResult.Yes) { if (Context.CheckLookup(Lookup.Id, this.Fields[this.CurrentRowIndex + 1][1])) { if (Context.DeleteRow(new List <string>(this.Fields[this.CurrentRowIndex + 1]), LookupModelm)) { CalculateFields(); OnPropertyChanged("Fields"); MessageBoxWrapper.Show("Записът е изтрит"); } else { MessageBoxWrapper.Show("Грешка при триене"); } } else { MessageBoxWrapper.Show("Записа не може да бъде изтрит защото се използва в салда или контировки"); } } } }
protected override void MovePrevius() { // Create OpenFileDialog OpenFileDialog dlg = new OpenFileDialog(); // Set filter for file extension and default file extension dlg.DefaultExt = ".conf"; // Display OpenFileDialog by calling ShowDialog method bool?result = dlg.ShowDialog(); // Get the selected file name and display in a TextBox if (result == true) { try { builder.LoadSettings(dlg.FileName); _reportItems = new ObservableCollection <ReportItem>(builder.ReportItems); } catch (Exception e) { MessageBoxWrapper.Show(e.Message); } OnPropertyChanged("ReportItems"); } }
protected override void Save() { if (Mode == EditMode.Edit) { if (_LookupModel != null) { if (Context.UpdateLookup(_LookupModel)) { MessageBoxWrapper.Show("Записа е променен"); } else { MessageBoxWrapper.Show("Грешка по време на запис"); } } } if (Mode == EditMode.Add) { _LookupModel.Fields = new List <TableField>(this._NomenclatureFieldsSelected); //this._LookupModel.Fields.Add(new TableField { Name = "Номер", DbField = "Integer", NameEng = "Id", Length = 10, IsNull = false }); Context.CreateTable(this._LookupModel); this._Lookups = new ObservableCollection <LookUpMetaData>(Context.GetAllLookups("")); OnPropertyChanged("Lookups"); } base.Save(); }
private async Task FillAttendeesAsync() { var seminarAttendeesToAdd = new List <AddSeminarAttendeesListItemDto>(); try { var existingAttendees = await _queryDao.ListAsync <SeminarAttendeesListItemDto>($"SeminarId = '{_seminarId}'"); var where = existingAttendees.Count == 0 ? "" : $"Id NOT IN ({string.Join(",", existingAttendees.Select(x => $"'{x.Id}'"))})"; seminarAttendeesToAdd = await _queryDao.ListAsync <AddSeminarAttendeesListItemDto>(where) .OnError(_ => MessageBoxWrapper.Error("Can't fill seminar attendees")); } catch (Exception) { MessageBoxWrapper.Error("Can't fill seminar attendees"); } foreach (var attendee in seminarAttendeesToAdd ?? new List <AddSeminarAttendeesListItemDto>()) { Attendees.Items.Add(new ListViewItem(new[] { attendee.Id, attendee.FullName, attendee.BirthDate.ToString("MM/dd/yyyy") }) { Tag = attendee }); } }
public static bool PatchAll() { var patchSuccess = false; LoggingWrapper.Log(LoggingWrapper.LogArea.All, LoggingWrapper.LogType.Message, $"Patching..."); try { LoggingWrapper.Log(LoggingWrapper.LogArea.All, LoggingWrapper.LogType.Message, $"Patching {PatchAssembly.GetName().Name}..."); patchSuccess = Patcher.PatchAll(); LoggingWrapper.Log(LoggingWrapper.LogArea.All, LoggingWrapper.LogType.Message, "Done!"); } catch (Exception ex) { LoggingWrapper.Log(LoggingWrapper.LogArea.All, LoggingWrapper.LogType.Error, $"Couldn't patch the required methods!"); LoggingWrapper.Log(LoggingWrapper.LogArea.Hidden, ex, true); } if (!patchSuccess) { MessageBoxWrapper.Show(MessageBoxWrapper.MessageType.Warning, $"{Details.ModName} couldn't start", $"{Details.ModName} couldn't fully start due to an issue overriding parts of the game.\n\n" + $"This is likely due to a recent update to Cities, and in order to prevent potential compatibility issues {Details.BaseModName} has disabled some functionality by reverting changes until a solution is found. This will result in most mod functionaity being disabled.\n\n" + $"If this has not previously been reported please do so, otherwise an update to the mod is required to fix the incompatibilites."); UnPatchAll(); } return(patchSuccess); }
public void EditFromOutside() { if (CurrentAccount != null) { if (CurrentAccount.Num < 1) { return; } if (CurrentAccount.SubNum == 0) { MainAcc ds = new MainAcc(CurrentAccount, EditMode.Edit, true); ds.ShowDialog(); if (ds.DialogResult.HasValue && ds.DialogResult.Value) { Refresh(); } } else { MainAcc dSubAcc = new MainAcc(CurrentAccount, EditMode.Edit, false); dSubAcc.ShowDialog(); if (dSubAcc.DialogResult.HasValue && dSubAcc.DialogResult.Value) { Refresh(); } } ; } else { MessageBoxWrapper.Show("Моля, изберете сметка"); } }
private void tbxBarcode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == terminator) { var barcoderReceivedEventArgs = new BarcodeReaderReceivedEventArgs(); barcoderReceivedEventArgs.Barcode = tbxBarcode.Text.TrimEnd(terminator); try { if (regex != null && !regex.IsMatch(barcoderReceivedEventArgs.Barcode)) { barcoderReceivedEventArgs.Barcode = BarcodeConst.ErrorBarcode; } } catch { barcoderReceivedEventArgs.Barcode = BarcodeConst.ErrorBarcode; } OnBarcoderReceived(this, barcoderReceivedEventArgs); if (barcoderReceivedEventArgs.ConfirmResult == ConfirmResult.OK) { barcodes.Add(barcoderReceivedEventArgs.Barcode); } if (barcoderReceivedEventArgs.ConfirmResult == ConfirmResult.NG) { MessageBoxWrapper.ShowDialog(this, $"条码校验出错,错误信息:“{barcoderReceivedEventArgs.ConfirmMessage }”,请确认!", MessageCaption.Information, MessageBoxButtons.OK); } tbxBarcode.Text = string.Empty; } }
private void Button_Click(object sender, RoutedEventArgs e) { if (vm.CopyCommand.CanExecute(null)) { if (dataGrid2D.SelectedItems != null && dataGrid2D.SelectedItems.Count > 0) { vm.SFields = new ObservableCollection <ObservableCollection <string> >(); foreach (var item in dataGrid2D.SelectedItems) { var iii = item as DataRowView; var newrow = new ObservableCollection <string>(); if (iii != null) { foreach (var o in iii.Row.ItemArray) { newrow.Add((o as DataGrid2DLibrary.Ref <System.String>).Value); } vm.SFields.Add(newrow); } } vm.CopyCommand.Execute(null); } } else { MessageBoxWrapper.Show("Не е избрана фирма, от която да се копират номенклатури"); } }
protected override void Delete() { LookupModel lookup = null; if (Lookup != null) { if ((this.CurrentRowIndex == -1)) { return; } lookup = Context.GetSysLookup(Lookup.Id); lookup.LookUpMetaData = Lookup; if (MessageBoxWrapper.Show(Resources.AnaliticManagerViewModel_Delete_res3, Resources.AnaliticManagerViewModel_Delete_res4, MessageBoxWrapperButton.YesNo) == MessageBoxWrapperResult.Yes) { if (Context.DeleteRow(new List <string>(this.Fields[this.CurrentRowIndex + 1]), lookup)) { CalculateFields(); OnPropertyChanged("Fields"); MessageBoxWrapper.Show(Resources.AnaliticManagerViewModel_Delete_res5); } else { MessageBoxWrapper.Show(Resources.AnaliticManagerViewModel_Delete_res2); } } } }
protected override void Add() { HoldingViewModel holding = new HoldingViewModel(new HoldingModel { Name = "New", IpServer = "localhost", Nom = Holdings.Count + 1 }); var conf = ConfigTempoSinglenton.GetInstance(); holding.ConnectionString = string.Format(Entrence.ConectionStringTemplate, holding.IpServer, conf.BaseDbPath, "H" + holding.Nom); Holdings.Add(holding); if ( MessageBoxWrapper.Show("Копиране на празна база от темплейтите?", "Предупреждение", MessageBoxWrapperButton.YesNo) == MessageBoxWrapperResult.Yes) { IoHelper.DirectoryCopy(ConfigTempoSinglenton.GetInstance().BaseTemplatePath, Path.Combine(ConfigTempoSinglenton.GetInstance().BaseDbPath, "H" + holding.Nom), true); } foreach (var item in conf.ConfigNames) { var spliter = item.Split('|'); FirmSettingModel newsett = new FirmSettingModel(); newsett.Key = spliter[0]; newsett.Name = spliter[1]; newsett.Value = spliter[2]; newsett.FirmaId = 1; newsett.HoldingId = holding.Nom; conf.FirmSettings.Add(newsett); } conf.SaveConfiguration(); }
private void Button_Click(object sender, RoutedEventArgs e) { IInputElement focusedElement = FocusManager.GetFocusedElement(this); if (focusedElement is TextBox) { var expression = (focusedElement as TextBox).GetBindingExpression(TextBox.TextProperty); if (expression != null) { expression.UpdateSource(); } } if (vm.IsEdit) { vm.UpdateCommand.Execute(sender); DialogResult = true; this.Close(); } else { if (vm.CheckSaldoItem()) { vm.SaveCommand.Execute(sender); DialogResult = true; this.Close(); } else { MessageBoxWrapper.Show("Вече е въведено салдо по тази номенклаура"); } } }
protected override void Delete() { if (MessageBoxWrapper.Show("Сигурни ли сте, че желаете да изтриете този запис?", "Предупреждение", MessageBoxWrapperButton.YesNo) == MessageBoxWrapperResult.Yes) { if (CurrentIndex != -1) { if (Context.DeleteFirma(CurrentFirma.Id)) { AllFirms.Remove(AllFirms[CurrentIndex]); MoveNext(); MessageBoxWrapper.Show("Записът е изтрит"); } else { MessageBoxWrapper.Show("Грешка при триене"); } } else { MessageBoxWrapper.Show("Не е избрана фирма за триене"); } } }
private async void OnSave(object sender, EventArgs e) { var valid = ValidateChildren(ValidationConstraints.Enabled); if (!valid) { return; } SaveBtn.Enabled = false; await _studentsService.CreateAsync(new CreateStudent { Id = PersonalIdTxt.Text, FullName = FullNameTxt.Text, FingerprintChecksum = _fingerPrintCheckSum, FingerprintImage = FingerprintPicture.Image.ToBytes(), Image = ImageBox.Image.ToBytes(), BirthDate = BirthDatePicker.Value }) .OnSuccess(() => MessageBoxWrapper.Info("Student created successfully")) .OnError(MessageBoxWrapper.Error); SaveBtn.Enabled = true; DialogResult = DialogResult.OK; Close(); }
private void CheckForIncompatibilities() { var incompatibleMods = Compatibility.IncompatibleMods; if (incompatibleMods.Count > 0) { var incompatibleStrings = new List <string>(); foreach (var incompatibleMod in incompatibleMods) { if (incompatibleMod != null) { var pluginName = incompatibleMod.PluginInfo.name; var instances = incompatibleMod.PluginInfo.GetInstances <IUserMod>(); if (instances.Length > 0) { pluginName = instances[0].Name; } incompatibleStrings.Add($"{pluginName}:\n{incompatibleMod.Description}"); } } if (incompatibleStrings.Count > 0) { MessageBoxWrapper.Show(MessageBoxWrapper.MessageType.Warning, $"{Details.ModName} incompatibilities", $"{Details.BaseModName} has detected some mod incompatibilities. These mods are known to not work with this mod: \n\n{string.Join("\n\n", incompatibleStrings.ToArray())}"); } } }
// Token: 0x0600002E RID: 46 RVA: 0x00003BB4 File Offset: 0x00003BB4 private void timer1_Tick(object sender, EventArgs e) { new StringBuilder(); int num = 1; foreach (Process process in Process.GetProcesses(".")) { try { if (process.MainWindowTitle.Length > 0) { if (process.MainWindowTitle == "SA-MP 0.3" && Client.GetTimestamp() > this.izinsuresi) { Process.GetProcessesByName(process.MainWindowTitle.ToString()); process.Kill(); MessageBoxWrapper.Show("Client açıkken SA-MP çalıştırılamaz.", "Rina Anti-Cheat"); this.izinsuresi = 0; } num++; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
static void Main(string[] args) { MessageBoxWrapper wrapper = new MessageBoxWrapper("I hope you love this message box!", "C# using Native Message Box", MessageBoxTypeEnum.OKCANCEL); wrapper.Display(); }
private void CopyFirmToFirm() { var allacc = Context.GetAllAccounts(CurrentFirmaWraperSource.Id); var oldcursor = Mouse.OverrideCursor; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; var AllAnaliticTypes = new ObservableCollection <AnaliticalAccountType>(Context.GetAllAnaliticalAccountType()); var AllAnaliticalFields = new ObservableCollection <AnaliticalFields>(Context.GetAllAnaliticalFields()); var AllConnectors = new ObservableCollection <MapAnanaliticAccToAnaliticField>(Context.GetAllConnectorAnaliticField()); var AlaMapToType = new ObservableCollection <MapAnanaliticAccToAnaliticField>(Context.GetAllConnectorTypeField()); foreach (AccountsModel accountsModel in allacc) { accountsModel.FirmaId = CurrentFirmaWraperDest.Id; var SelectedConnectors = new ObservableCollection <MapAnanaliticAccToAnaliticField>( AllConnectors.Where(e => e.AnaliticalNameID == accountsModel.AnaliticalNum)); ObservableCollection <AnaliticalFields> SelectedAnaliticalFields = new ObservableCollection <AnaliticalFields>(); foreach (var curr in SelectedConnectors) { var addfield = AllAnaliticalFields.Where(e => e.Id == curr.AnaliticalFieldId).FirstOrDefault(); if (addfield != null) { addfield.Requared = curr.Required; if (addfield != null) { SelectedAnaliticalFields.Add(addfield); } } } Context.LoadMapToLookUps(SelectedAnaliticalFields, accountsModel.Id, accountsModel.AnaliticalNum); var CurrentAllTypeAccount = AllAnaliticTypes.Where(e => e.Id == accountsModel.TypeAnaliticalKey).FirstOrDefault(); //SelectedConnectors = // new ObservableCollection<MapAnanaliticAccToAnaliticField>( // AlaMapToType.Where(e => e.AnaliticalFieldId == accountsModel.TypeAnaliticalKey)); //ObservableCollection<AnaliticalFields> SelectedAnaliticalTypeFields=new ObservableCollection<AnaliticalFields>(); //foreach (var curr in SelectedConnectors) //{ // var addfield = AllAnaliticalFields.FirstOrDefault(e => e.Id == curr.AnaliticalNameID); // if (addfield != null) // { // addfield.Requared = curr.Required; // SelectedAnaliticalTypeFields.Add(addfield); // } //} string errormessage; if (!Context.UpdateAccount(accountsModel, true, SelectedAnaliticalFields, out errormessage)) { MessageBoxWrapper.Show(string.Format(" Грешка при копиране на сметкоплана от фирма {0} е копиран на фирма {1} заради грешка {2}", CurrentFirmaWraperSource.CurrentFirma.Name, CurrentFirmaWraperDest.CurrentFirma.Name, errormessage), "Предупреждение"); } } Mouse.OverrideCursor = oldcursor; MessageBoxWrapper.Show(string.Format("Сметкоплана от Фирма {0} е копиран на {1}", CurrentFirmaWraperSource.CurrentFirma.Name, CurrentFirmaWraperDest.CurrentFirma.Name), "Известие"); }
void AddSampleData() { ContextMenu subMenu = window.MainMenu.OpenSubMenu("MenuHelp"); subMenu.InvokeMenuItem("MenuSampleData"); AutomationElement msgbox = window.FindChildWindow("Add Sample Data", 5); if (msgbox != null) { MessageBoxWrapper mbox = new MessageBoxWrapper(msgbox); mbox.ClickYes(); } AutomationElement child = window.FindChildWindow("Sample Database Options", 10); if (child != null) { SampleDataDialogWrapper cd = new SampleDataDialogWrapper(child); cd.ClickOk(); } Thread.Sleep(5000); window.WaitForInputIdle(5000); Save(); sampleData = true; // give database time to flush... Thread.Sleep(2000); // now load the database and pull out the categories. MyMoney money = Load(); List <string> categories = new List <string>(); foreach (Category c in money.Categories) { string cat = c.GetFullName(); categories.Add(cat); } categories.Sort(); SampleCategories = categories.ToArray(); List <string> payees = new List <string>(); foreach (Payee p in money.Payees) { payees.Add(p.Name); } payees.Sort(); SamplePayees = payees.ToArray(); ClearTransactionViewState(); }
private static void CheckForExperimentalVersion() { if (Details.ExperimentalBuild && UserModSettings.RecentlyUpdated) { var title = string.Format(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.ExperimentalBuild_Title), Details.BaseModName); var description = string.Format(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.ExperimentalBuild_Description), Details.BaseModName); MessageBoxWrapper.Show(MessageBoxWrapper.MessageType.Warning, title, description); } }
private async void FillFormAsync() { var student = await _dao.GetAsync <StudentsDetailsDto>(_id) .OnError(_ => MessageBoxWrapper.Error("Can't get student")); PersonalIdValue.Text = student.Id; FullNameValue.Text = student.FullName; BirthDateValue.Text = student.BirthDate.ToString("MM/dd/yyyy"); ImageBox.Image = student.Image.ToBitmap(); FingerprintBox.Image = student.FingerprintImage.ToBitmap(); }
private static void PatchOptional() { var patched = true; patched = patched && OptionalPatch(new NewCommonBuildingAI_GetColor(), ref FeatureToggles.LightingModificationsActive); if (!patched) { MessageBoxWrapper.Show(MessageBoxWrapper.MessageType.Warning, string.Format(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Incompatibility_Title), Details.BaseModName), LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Incompatibility_Description)); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (CheckForPermition) { ConfigTempoSinglenton currentconfig = ConfigTempoSinglenton.GetInstance(); if (currentconfig.Periods.FirstOrDefault(e1 => e1.Fr <= dater.SelectedDate && e1.To >= dater.SelectedDate && e1.Firma == currentconfig.ActiveFirma && e1.Holding == currentconfig.ActiveHolding) != null) { MessageBoxWrapper.Show("Забранен период не може да се сетне датата " + dater.SelectedDate); return; } } DialogResult = true; }
private async Task RefreshTableAsync() { var seminars = await _queryDao.ListAsync <SeminarsListItemDto>() .OnError(_ => MessageBoxWrapper.Error("Can't fill seminars Table")); seminarsListItemDtoBindingSource.DataSource = seminars; _selectedSeminarId = seminars.FirstOrDefault()?.Id; if (_selectedSeminarId != null) { SeminarAttendeesBtn.Enabled = true; } }
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { Visible = System.Windows.Visibility.Hidden; if (String.IsNullOrWhiteSpace(Error)) { MessageBoxWrapper.Show("Приключването е готово"); } else { MessageBoxWrapper.Show(Error); Error = null; } }
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { lab.Visibility = Visibility.Hidden; et.Visibility = Visibility.Hidden; vartok.Visibility = Visibility.Hidden; if (string.IsNullOrWhiteSpace(Rez)) { MessageBoxWrapper.Show("Командата се изпълни успешно"); } else { MessageBoxWrapper.Show("Командата даде грешка " + Rez); } }
protected override void Delete() { if (MessageBoxWrapper.Show("Сигурни ли сте, че желаете да изтриете този запис?", "Предупреждение", MessageBoxWrapperButton.YesNo) == MessageBoxWrapperResult.Yes) { if (!Context.DeleteDdsDnevnicModel(ddsDnevnikModel.Id)) { MessageBoxWrapper.Show("Грешка при триене"); } else { OnRefreshExecuted(new DdsEventArgs(this.KindActivity)); } } }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (MessageBoxWrapper.Show("Сигурни ли сте, че желаете да изтриете всички елементи от номенклатурата за фирмата?", "Предупреждение", MessageBoxWrapperButton.YesNo) == MessageBoxWrapperResult.Yes) { string rez = vm.DeleteAllItemsFirma(); if (rez == "") { MessageBoxWrapper.Show("Записите са изтрити"); } else { MessageBoxWrapper.Show("Грешка \n" + rez); } } }
private async Task RefreshTableAsync() { RemoveSeminarAttendeeBtn.Enabled = false; var attendees = await _queryDao.ListAsync <SeminarAttendeesListItemDto>($"SeminarId='{_seminarId}'") .OnError(_ => MessageBoxWrapper.Error("Can't fill seminar attendees")); seminarAttendeesListItemDtoBindingSource.DataSource = attendees; _selectedAttendeeId = attendees.FirstOrDefault()?.Id; if (_selectedAttendeeId != null) { RemoveSeminarAttendeeBtn.Enabled = true; } }
private async void OnRemoveSeminarAttendeeBtnClick(object sender, System.EventArgs e) { var dialogResult = MessageBoxWrapper.Confirmation($"Are you sure you want to unregister attendee {_selectedAttendeeId}"); if (dialogResult == DialogResult.Yes) { await _commandService.UnRegisterAttendeeAsync(new UnRegisterAttendeeAtSeminar { Id = _seminarId, AttendeeId = _selectedAttendeeId }); } await RefreshTableAsync(); }
private bool ValidateProperties() { var wrapper = new MessageBoxWrapper(); if (!Port.ToLower().StartsWith("com")) { wrapper.Show("Port must start with Com", "Local Device Setup", MessageBoxButton.OK); return false; } return true; }