private void Cancel(object obj) { if (CloseAction != null) { CloseAction.Invoke(); } }
//登录 public void Confirm() { try { if (Check()) { ReadClientConfig(); if (CheckLogin()) { ListmenuItem = GetItems(listCheckUesrInfo[0].menuitem); listCheckUesrInfo[0].menuitem = ListmenuItem.ToArray <MenuItem>(); MainWindow mw = new MainWindow(); mw.ui = listCheckUesrInfo[0]; //mw.Show(); Common.CommonData.GetInstance().ListCheckUesrInfo = listCheckUesrInfo[0]; CloseAction.Invoke(); } } } catch (Exception ex) { lg.LogWrite(Logger.LogLevel.Debug, "", ex.ToString()); MessageBox.Show("网络异常,请联系管理员!"); return; } }
private void OKExecute(object obj) { bool allMappingsValid = true; bool isValid; var mappings = GetMappings(out isValid); allMappingsValid &= isValid; if (mappings != null) { foreach (var m in mappings) { var mappingsValid = m.PhaidraAttribute.ValidateMappings(m); if (!mappingsValid) { Logger.LogW($"Mappings of Attribute {m.PhaidraAttribute.Name} invalid"); } allMappingsValid &= mappingsValid; } } if (allMappingsValid) { DialogResult = true; CloseAction?.Invoke(); } else { DebugCommand.Execute(null); } }
/// <summary> /// Adiciona os arquivos gerados nos projetos de Portal e Model /// </summary> /// <param name="createdFiles"></param> private void AddGenerateFilesToProject(Dictionary <String, TypeFile> createdFiles) { createdFiles.Where(file => file.Value == TypeFile.Model).ToList().ForEach(file => { AddFile(file.Key, Project.BuildActions.Compile, modelProject); }); createdFiles.Where(file => file.Value == TypeFile.Portal).ToList().ForEach(file => { if (file.Key.Contains("cshtml")) { AddFile(file.Key, Project.BuildActions.Resource, portalProject); } else { AddFile(file.Key, Project.BuildActions.Compile, portalProject); } }); createdFiles.Where(file => file.Value == TypeFile.PortalBusiness).ToList().ForEach(file => { AddFile(file.Key, Project.BuildActions.Compile, portalBusinessProject); }); createdFiles.Where(file => file.Value == TypeFile.WebDriverPages).ToList().ForEach(file => { AddFile(file.Key, Project.BuildActions.Compile, webPagesProject); }); modelProject.Save(); portalProject.Save(); portalBusinessProject.Save(); webPagesProject.Save(); CloseAction.Invoke(); }
//获取用户权限职责 private void GetUserDspInfo() { //加密 Encryption4Net.Encryption encryption = new Encryption4Net.Encryption(); string inputPsw = encryption.EnCode(ui.UserPwd); ui.UserPwd = inputPsw; encryption = null; listCheckUesrInfo = LoginClient.Current.CheckUserInfo(ui); if (listCheckUesrInfo.Count == 0) { MessageBox.Show("用户名或密码不存在!"); } else { ListmenuItem = GetItems(listCheckUesrInfo[0].menuitem); listCheckUesrInfo[0].menuitem = ListmenuItem.ToArray <MenuItem>(); MainWindow mw = new MainWindow(); mw.ui = listCheckUesrInfo[0]; mw.Show(); CloseAction.Invoke(); } }
public TraktDialogViewModel(ITraktService traktService) { _traktService = traktService; CloseCommand = new RelayCommand(() => { CloseAction.Invoke(); }); InitializeAsyncCommand = new RelayCommand(async() => { try { IsLoading = true; IsLoggedIn = await _traktService.IsLoggedIn(); TraktOAuthUrl = !IsLoggedIn ? _traktService.GetAuthorizationUrl() : string.Empty; } catch (Exception ex) { Logger.Error(ex); } finally { IsLoading = false; } }); }
public async Task ValidateOAuthCode(string code) { IsLoading = true; await _traktService.AuthorizeAsync(code); IsLoading = false; CloseAction.Invoke(); }
// ========================================= // ViewModel Commands Collection Handler. // ========================================= private void InvokeRequestClose(RequestCloseEventArgs e) { if ((bool)e.ViewModelOutputData) { DialogResult = true; } CloseAction?.Invoke(); }
private void ExecButtonTwo() { if (OnButtonTwoAction != null) { OnButtonTwoAction.Invoke(); } CloseAction.Invoke(); }
private void OnCancel() { model.ReloadSettings(); MainWindow win = (MainWindow)Application.Current.MainWindow; win.Show(); // triggers the Close Action of the settings window . CloseAction?.Invoke(); }
private void Button_OnClicked(object sender, EventArgs e) { if (Result.SelectedItem == null) { return; } FinalResult = Result.SelectedItem.ToString(); CloseAction?.Invoke(); }
public async Task Login() { _loginViewModel = new LoginViewModel(); LoginWindow loginWindow = new LoginWindow(_loginViewModel); _loginViewModel.CloseAction = () => { loginWindow.Close(); }; await loginWindow.ShowDialog(_parentWindow); if (!_loginViewModel.DialogResult) { CloseAction?.Invoke(); } }
/// <exception cref="Exception">A delegate callback throws an exception.</exception> public ManagePluginSourceViewModel(IManagePluginSourceModel updateManager, IEventAggregator aggregator, IAsyncWorker asyncWorker) : base("PluginSource") { VerifyArgument.IsNotNull("asyncWorker", asyncWorker); VerifyArgument.IsNotNull("updateManager", updateManager); VerifyArgument.IsNotNull("aggregator", aggregator); _updateManager = updateManager; DllChooser = new DLLChooser(updateManager); HeaderText = Resources.Languages.Core.PluginSourceNewHeaderLabel; Header = Resources.Languages.Core.PluginSourceNewHeaderLabel; OkCommand = new DelegateCommand(o => Save(), o => CanSave()); FileSystemAssemblyName = string.Empty; ConfigFilePath = string.Empty; GACAssemblyName = string.Empty; ChooseFileSystemDLLCommand = new DelegateCommand(o => { var dll = DllChooser.GetFileSystemDLL(); if (dll != null) { FileSystemAssemblyName = dll.FullName; } }); ChooseGACDLLCommand = new DelegateCommand(o => { var dll = DllChooser.GetGacDLL(); if (dll != null) { GACAssemblyName = dll.FullName; } }); ChooseConfigFileCommand = new DelegateCommand(o => { var fileChooser = CustomContainer.GetInstancePerRequestType <IFileChooserView>(); fileChooser.ShowView(false); var vm = fileChooser.DataContext as FileChooser; if (vm != null && vm.Result == MessageBoxResult.OK) { var selectedFiles = vm.GetAttachments(); if (selectedFiles != null && selectedFiles.Count > 0) { ConfigFilePath = selectedFiles[0]; } } }); CancelCommand = new DelegateCommand(o => CloseAction.Invoke()); _warewolfserverName = updateManager.ServerName; }
public override void PostClose() { if (ConfirmButtonLabel != null) { if (confirmed) { CloseAction?.Invoke(); } } else { CloseAction?.Invoke(); } }
private async void Reject() { try { App app = App.GetApp(); var accessToken = app.AccessToken; await app.GetService <SummonRequestService>() .Reject(Request.Id, accessToken.Id); CloseAction?.Invoke(); } catch (Exception e) { log.Error("Failed to reject request", e); } }
private void RedirectToMainWindow(string token) { MainWindow mainWindow = new MainWindow(token); mainWindow.Show(); try { CloseAction.Invoke(); } catch (NullReferenceException) { log.Debug("When created LoginWindowVM CloseAction wasn't bound"); throw; } }
public TraktDialogViewModel() { _traktService = new TraktService(); CloseCommand = new RelayCommand(() => { CloseAction.Invoke(); }); InitializeAsyncCommand = new RelayCommand(async() => { IsLoading = true; IsLoggedIn = await _traktService.IsLoggedIn(); IsLoading = false; TraktOAuthUrl = !IsLoggedIn ? _traktService.GetAuthorizationUrl() : string.Empty; }); }
private void Save(object obj) { UpdateEntity(); var reportStatusService = ServiceLocator.Current.GetInstance <IReportStatusService>(); reportStatusService.TournamentUpdated = true; ServiceLocator.Current .GetInstance <IEventAggregator>() .GetEvent <TournamentDataUpdatedEvent>() .Publish(new TournamentDataUpdatedEventArgs()); if (CloseAction != null) { CloseAction.Invoke(); } }
public void OnSave() { //validare date if (!IsDataValid()) { return; } //is addNew ? if (IdComanda == 0) { Utils.Ctx.comenzis.Add(Item); } Utils.Ctx.SaveChanges(); CloseAction?.Invoke(true); }
public async Task ValidateOAuthCode(string code) { try { IsLoading = true; await _traktService.AuthorizeAsync(code); IsLoggedIn = true; } catch (Exception ex) { Logger.Error(ex); } finally { IsLoading = false; CloseAction.Invoke(); } }
public void registerNewPatient() { DateTime now = DateTime.Now; _patient = new Patient(Name, Surname, Gender, DateOfBirth, Convert.ToInt32(MobileNumber), Email, now); _receptionist = new Receptionist(); try { _receptionist.registerNewPatient(_patient); _medicalCard = new MedicalCard(_patient.getPatientIDFromDb()); _receptionist.createMedicalCard(_medicalCard); _receptionist.updatePatientMedicalCard(_patient, _medicalCard); CloseAction.Invoke(); } catch (MySqlException ex) { ErrorMessage = "Problem with writing data(MySQLException)"; } }
/// <exception cref="Exception">A delegate callback throws an exception.</exception> public ManageComPluginSourceViewModel(IManageComPluginSourceModel updateManager, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IAsyncWorker asyncWorker) : base("ComPluginSource") { VerifyArgument.IsNotNull("asyncWorker", asyncWorker); VerifyArgument.IsNotNull("updateManager", updateManager); VerifyArgument.IsNotNull("aggregator", aggregator); _updateManager = updateManager; AsyncWorker = asyncWorker; HeaderText = Resources.Languages.Core.ComPluginSourceNewHeaderLabel; Header = Resources.Languages.Core.ComPluginSourceNewHeaderLabel; OkCommand = new DelegateCommand(Save, CanSave); CancelCommand = new DelegateCommand(() => CloseAction.Invoke()); ClearSearchTextCommand = new DelegateCommand(() => SearchTerm = ""); RefreshCommand = new DelegateCommand(() => PerformLoadAll()); _warewolfserverName = updateManager.ServerName; if (Application.Current != null && Application.Current.Dispatcher != null) { DispatcherAction = Application.Current.Dispatcher.Invoke; } }
private void OnOk() { if (ShouldCacheMovies && !Directory.Exists(CachePath)) { Directory.CreateDirectory(CachePath); } if (!ShouldCacheMovies) { MovieManager.CancelRunningJob(); } Settings.Instance.UseTimeOfDay = UseTimeOfDay; Settings.Instance.MovieWindowsMode = MovieWindowsMode; Settings.Instance.ShouldCacheMovies = ShouldCacheMovies; Settings.Instance.CachePath = CachePath; Settings.Instance.PlayInLoop = PlayInLoop; Settings.Instance.BlankOnRemoteDesktop = BlankOnRemoteDesktop; Settings.Instance.Save(); CloseAction?.Invoke(); }
private void CloseEvent() { CloseAction?.Invoke(); }
private void CloseCommandExecute() { CloseAction?.Invoke(); }
private void CloseButton_Click(object sender, System.Windows.RoutedEventArgs e) { _closeAction?.Invoke(); }
public void HandleInsertTemplateClick() { ReturnFunc.Invoke(core.FillTemplate(selectedItem)); CloseAction.Invoke(); }
private void CloseAppClick(object sender, EventArgs e) { CloseAction?.Invoke(); }
internal void Close() { CloseAction?.Invoke(); }
private void Save() { if (!HasNotes) { if (player == null) { CloseAction?.Invoke(); return; } // check if notes exist because notes might be added on another table var notes = dataService.GetPlayerNotes(player.PlayerId); var manualNote = notes.FirstOrDefault(x => !x.IsAutoNote); if (manualNote == null) { manualNote = new Playernotes { PlayerId = player.PlayerId, PokersiteId = player.PokersiteId, Timestamp = DateTime.UtcNow }; playerNoteEntities.Add(manualNote); } manualNote.Note = Note; dataService.Store(manualNote); CloseAction?.Invoke(); return; } // no auto if (playerNoteEntities.All(x => !x.IsAutoNote)) { if (string.IsNullOrEmpty(Note)) { dataService.DeletePlayerNotes(playerNoteEntities); playerNoteEntities.Clear(); } else { var manualNote = playerNoteEntities.FirstOrDefault(); manualNote.Note = Note; dataService.Store(manualNote); } CloseAction?.Invoke(); return; } var newNotes = NoteBuilder.ParseNotes(Note); var manualNoteText = newNotes.Item1; // no auto if (string.IsNullOrEmpty(newNotes.Item2)) { // delete auto notes if exists var notesToDelete = playerNoteEntities.Where(x => x.IsAutoNote).ToArray(); dataService.DeletePlayerNotes(notesToDelete); notesToDelete.ForEach(x => playerNoteEntities.Remove(x)); } else { // check if any auto notes if (playerNoteEntities.Any(x => x.IsAutoNote)) { var oldNotes = NoteBuilder.ParseNotes(initialNotes); // if auto note were changed, then make them all manual if (newNotes.Item2 != oldNotes.Item2) { // delete all auto notes because we move them to manual var notesToDelete = playerNoteEntities.Where(x => x.IsAutoNote).ToArray(); dataService.DeletePlayerNotes(notesToDelete); notesToDelete.ForEach(x => playerNoteEntities.Remove(x)); manualNoteText = Note; } } else { manualNoteText = Note; } } // no manual if (string.IsNullOrEmpty(manualNoteText)) { // delete manual notes if exists var notesToDelete = playerNoteEntities.Where(x => !x.IsAutoNote).ToArray(); dataService.DeletePlayerNotes(notesToDelete); notesToDelete.ForEach(x => playerNoteEntities.Remove(x)); } else { var manualNote = playerNoteEntities.FirstOrDefault(x => !x.IsAutoNote); if (manualNote == null) { if (player == null) { CloseAction?.Invoke(); return; } manualNote = new Playernotes { PlayerId = player.PlayerId, PokersiteId = player.PokersiteId, Timestamp = DateTime.UtcNow }; playerNoteEntities.Add(manualNote); } manualNote.Note = manualNoteText; dataService.Store(manualNote); } CloseAction?.Invoke(); }