public MainWindowViewModel() { try { Characters = TokenRepo <Character> .Load($"Resources{Path.DirectorySeparatorChar}{_charactermap}"); } catch { } try { Vehicles = TokenRepo <Vehicle> .Load($"Resources{Path.DirectorySeparatorChar}{_vehiclemap}"); } catch { } var tokenVm = new TokenSelectionViewModel(Characters, Vehicles); var deviceVm = new DeviceViewModel(); var cryptoVm = new CryptoViewModel(); Workspaces.Add(cryptoVm); Workspaces.Add(tokenVm); Workspaces.Add(deviceVm); SetActiveWorkspace(cryptoVm); }
/// <summary> /// Load workspaces for the given Workspace Collection Name /// </summary> /// <param name="workspaceCollectionName"></param> /// <param name="accessKey"></param> /// <returns></returns> public async Task LoadWorkspacesAsync(string workspaceCollectionName, string accessKey) { Status = "Loading..."; IsLoading = true; IsLoaded = false; Workspaces.Clear(); using (var client = CreateClient(accessKey)) { var response = await client.Workspaces.GetWorkspacesByCollectionNameAsync(workspaceCollectionName); if (response.Value != null) { foreach (var workspace in response.Value) { Workspaces.Add(new Models.Workspace() { WorkspaceId = workspace.WorkspaceId }); } Status = "Loaded."; IsLoaded = true; } else { Status = "Failed. Cannot get workspaces"; } } IsLoading = false; }
public async Task <string> CreateWorkspaceAsync(string workspaceCollectionName, string accessKey) { string ret = null; Status = "Loading..."; IsLoading = true; IsLoaded = false; using (var client = CreateClient(accessKey)) { var workspace = await client.Workspaces.PostWorkspaceAsync(workspaceCollectionName); if (workspace != null) { ret = workspace.WorkspaceId; Workspaces.Add(new Models.Workspace() { WorkspaceId = ret }); } } IsLoading = false; IsLoaded = true; return(ret); }
void AggiungiSchedaRisultatiRicercaDipendentePerFigura(FiguraProfessionale figura) { RisultatiDipendentePerFiguraViewModel visualizza = new RisultatiDipendentePerFiguraViewModel(figura); Workspaces.Add(visualizza); SetActiveWorkspace(visualizza); }
void AggiungiSchedaRisultatiRicercaFiguraPerDipendente(Dipendente dipendente) { RisultatiFiguraPerDipendenteViewModel visualizza = new RisultatiFiguraPerDipendenteViewModel(dipendente); Workspaces.Add(visualizza); SetActiveWorkspace(visualizza); }
public MainWindowViewModel() { /*Adding PathList view model to workspaces collection*/ ViewModelBase pathList = new PathListViewModel(); Workspaces.Add(pathList); }
public void Show(LaytonFormShell shell) { this.formShell = shell; LaytonSettingsWorkItem settingsWorkItem = this.WorkItems.AddNew <LaytonSettingsWorkItem>(WorkItemNames.SettingsWorkItem); settingsWorkItem.Show(); Workspaces.Add(settingsWorkItem.TabWorkspace, Layton.Cab.Interface.WorkspaceNames.SettingsTabWorkspace); LaytonToolbarsWorkItem toolbarsWorkItem = this.WorkItems.AddNew <LaytonToolbarsWorkItem>(WorkItemNames.ToolbarsWorkItem); toolbarsWorkItem.Show(); LaytonProductKey productKey = LoadProductKey(); if (productKey.IsTrial) { LaytonRegistrationForm registerForm = new LaytonRegistrationForm(productKey); registerForm.ShowDialog(); productKey = registerForm.ProductKey; } this.Items.Add(productKey, MiscStrings.ProductKey); this.Activate(); }
public async void LoadWorkspaces() { #if DEBUG var watch = Stopwatch.StartNew(); #endif foreach (var workspace in WorkspaceManagement.Workspaces) { Workspaces.Add(new WorkspaceViewModel(workspace)); } Messenger.Default.Register <CloseAddWorkspaceFlyoutMessage>(this, message => IsAddingWorkspace = false); Messenger.Default.Register <AddWorkspaceMessage>(this, message => { if (message.Workspace != null) { Workspaces.Add(new WorkspaceViewModel(message.Workspace)); } }); foreach (var workspace in Workspaces) { await workspace.Init(); } #if DEBUG Logger.Trace("Loaded all workspaces: {0} ms", watch.ElapsedMilliseconds); #else Logger.Debug("Loaded all workspaces"); #endif }
private void AddNewLog(object obj) { Workspaces.Clear(); AddLogViewModel workspace = new AddLogViewModel(Workspaces); Workspaces.Add(workspace); SetActiveWorkspace(workspace); }
private void EditLog(object obj) { Workspaces.Clear(); EditLogViewModel workspace = new EditLogViewModel(_workspaces); Workspaces.Add(workspace); SetActiveWorkspace(workspace); }
public async Task OnGet() { var teams = await _teamRepo.GetAllTeams(); foreach (var t in teams) { Workspaces.Add(t); } }
public void AddWorkspace(Workspace workspace) { if (Workspaces.Any(w => w.Name == workspace.Name)) { throw new InvalidOperationException("Workspace name must be unique"); } Workspaces.Add(workspace); }
private void SetProcessCount(int count) { Workspaces.Clear(); foreach (var workspace in Enumerable.Range(0, count).Select(index => new ProcessContainerViewModel((uint)index))) { Workspaces.Add(workspace); } SetActiveWorkspace(Workspaces.FirstOrDefault()); }
public async Task OnGet() { var teams = await _teamRepo.GetAllTeams(); foreach (var t in teams) { Workspaces.Add(t); } CurrentLeagueIndexingBookmark = await _indexBookmarkProvider.GetBookmark(); }
//Azione eseguita quando faccio doppioclick su un elemento della listview "VisualizzaDipendenteView" void AggiungiSchedaRisultatiRicercaFiguraProf(FiguraProfessionale figuraProf) { FiguraProfessionaleViewModel visualizza = new FiguraProfessionaleViewModel(figuraProf) { //Dipendente = dipendente, RicercaDipendentePerFigura = AggiungiSchedaRisultatiRicercaDipendentePerFigura }; Workspaces.Add(visualizza); SetActiveWorkspace(visualizza); }
void ShowAllUsers() { WorkspaceBaseVM workspace = this.Workspaces.FirstOrDefault(vm => vm is AllUsersVM) as WorkspaceBaseVM; if (workspace == null) { workspace = new AllUsersVM(_userRepository, this); Workspaces.Add(workspace); } SetActiveWorkspace(workspace); }
//Azione eseguita quando faccio doppioclick su un elemento della listview "VisualizzaDipendenteView" void AggiungiSchedaRisultatiRicercaAnagrafica(Dipendente dipendente) { DipendenteViewModel visualizza = new DipendenteViewModel(dipendente) { //Dipendente = dipendente, RicercaFiguraPerDipendente = AggiungiSchedaRisultatiRicercaFiguraPerDipendente }; Workspaces.Add(visualizza); SetActiveWorkspace(visualizza); }
private void NewWorkspace() { StatusText = "Opening New Document"; var workspace = new DocumentViewModel { HeaderText = "New Workspace " }; Workspaces.Add(workspace); this.SelectedIndex = Workspaces.IndexOf(workspace); StatusText = "Opened Document"; }
public ServiceDocument(IEnumerable <Workspace> workspaces) : this() { if (workspaces != null) { foreach (var w in workspaces) { Workspaces.Add(w); } } }
void ToonBrouwers() { var workspace = Workspaces.OfType <BrouwersViewModel>().FirstOrDefault(); if (workspace == null) { workspace = (BrouwersViewModel)_viewModelFactory.CreateViewModel(ViewType.Brouwers); //workspace = new BrouwersViewModel(_dataService, _dialogService, _fileDialog,_mapper); Workspaces.Add(workspace); } this.SetActiveWorkspace(workspace); }
private void CreateWorkspaceCmdExec(object parm) { CreateWorkspaceModal createModal = new CreateWorkspaceModal(); Nullable <bool> dialogresult = createModal.ShowDialog(); if (dialogresult.Value == true) { var workspace = ((CreateWorkspaceViewModel)createModal.DataContext).workspace; Workspaces.Add(workspace); SaveWorkspaces(); } }
void ToonSoorten() { var workspace = Workspaces.OfType <SoortenViewModel>().FirstOrDefault(); if (workspace == null) { workspace = (SoortenViewModel)_viewModelFactory.CreateViewModel(ViewType.BierSoorten); // workspace = new SoortenViewModel(_dataService, _dialogService, _fileDialog, _mapper); Workspaces.Add(workspace); } this.SetActiveWorkspace(workspace); }
public void AddWorkspace(string title, QueryWorkspaceView workspaceView) { Workspaces.Add(workspaceView); var newTab = new QWBTabPage(title); var newWorkspace = workspaceView.WithDockStyle(DockStyle.Fill) .WithContainer(newTab); workspaceView.OnDirtyChanged += WorkspaceView_OnDirtyChanged; workspaceView.OnSaved += WorkspaceView_OnSaved; newTab.SetWorkspace(newWorkspace); mainTabControl.TabPages.Add(newTab); mainTabControl.SelectedTab = newTab; }
//Создать рабочую область private void CreateWorkspace(object sender, DataEventArgs args) { switch (args.Data) { case "CreatePositiveResponse": { PositiveResponseViewModel positiveResponse = new PositiveResponseViewModel() { NameWorkspace = "Положительный ответ" }; Workspaces.Add(positiveResponse); ActivateWorkspace(Workspaces, positiveResponse); break; } } }
public void New(ViewModelBase viewmodel, bool unique) { if (unique) { WorkspaceViewModel workspace = ContainsViewModel(viewmodel); if (workspace != null) { SelectedWorkspace = workspace; return; } } WorkspaceViewModel newspace = new WorkspaceViewModel(this, viewmodel); Workspaces.Add(newspace); SelectedWorkspace = newspace; }
/// <summary> /// Обновляет список рабочих областей /// </summary> private void OnWorkspacesChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null && e.NewItems.Count != 0) { foreach (Source source in e.NewItems) { var vs = new PatientSearchViewModel(source); Workspaces.Add(vs); SetActiveWorkspace(vs); } } if (e.OldItems != null && e.OldItems.Count != 0) { foreach (Source source in e.OldItems) { Workspaces.Remove(FindWorkspace(source)); } } }
private void EditCustomerMessageSink(CustomerModel editableCustomer) { if (!IsNewWorkSpaceItemAllowed <AddEditCustomerViewModel>()) { messageBoxService.ShowWarning( "There is already an Add/Edit View open\r\n\r\n" + "This application only allows 1 active Add/Edit view\r\n" + "to be opened at 1 time"); return; } AddEditCustomerViewModel addEditCustomerViewModel = new AddEditCustomerViewModel(); addEditCustomerViewModel.IsCloseable = true; addEditCustomerViewModel.CurrentCustomer = editableCustomer; addEditCustomerViewModel.CurrentViewMode = ViewMode.EditMode; Workspaces.Add(addEditCustomerViewModel); this.SetActiveWorkspace(addEditCustomerViewModel); }
public async void CreateWorkspace() { CreateWorkspacePopUpIsOpen = false; ActivityStatus = String.Format("Your Workspace {0} is being created...", WorkspaceNameToCreate); LoadingActivityStarted(true); var createdWorkspace = await PBIEClient.CreateWorkspace(WorkspaceNameToCreate); if (createdWorkspace != null) { ActivityStatus = "Your workspace has been created"; Workspaces.Add(createdWorkspace); IsWorkspaceResultVisible = false; } else { DisplayMessage("Create new Workspace", "Something went wrong, please try again"); } LoadingActivityStarted(false); }
/// <summary> /// Executes the SearchCustomersCommand /// </summary> private void ExecuteSearchCusomersCommand() { if (!IsNewWorkSpaceItemAllowed <SearchCustomersViewModel>()) { messageBoxService.ShowWarning( "There is already an Search open\r\n\r\n" + "This application only allows 1 active Search view\r\n" + "to be opened at 1 time"); return; } SearchCustomersCommand.CommandSucceeded = false; SearchCustomersViewModel searchCustomersViewModel = new SearchCustomersViewModel(); searchCustomersViewModel.IsCloseable = true; Workspaces.Add(searchCustomersViewModel); this.SetActiveWorkspace(searchCustomersViewModel); SearchCustomersCommand.CommandSucceeded = true; }
/// <summary> /// Executes the AddCustomerCommand /// </summary> private void ExecuteAddCustomerCommand() { AddCustomerCommand.CommandSucceeded = false; if (!IsNewWorkSpaceItemAllowed <AddEditCustomerViewModel>()) { messageBoxService.ShowWarning( "There is already an Add/Edit View open\r\n\r\n" + "This application only allows 1 active Add/Edit view\r\n" + "to be opened at 1 time"); return; } AddEditCustomerViewModel addEditCustomerViewModel = new AddEditCustomerViewModel(); addEditCustomerViewModel.IsCloseable = true; addEditCustomerViewModel.CurrentViewMode = ViewMode.AddMode; Workspaces.Add(addEditCustomerViewModel); this.SetActiveWorkspace(addEditCustomerViewModel); AddCustomerCommand.CommandSucceeded = true; }