/// <summary> /// Remove a layout item from this instance. /// </summary> /// <param name="item">The item to remove.</param> /// <returns>True if the item was sucsessfully remove, else false.</returns> public bool RemoveLayoutItem(ILayoutItemViewModel item) { bool sucsess; switch (item) { case IToolViewModel tool: sucsess = AnchorablesSource.Remove(tool); break; case IDocumentViewModel document: sucsess = DocumentsSource.Remove(document); break; default: sucsess = false; break; } if (item == ActiveContent && sucsess) { ILayoutItemViewModel newActive = DocumentsSource.FirstOrDefault(); if (newActive is null) { newActive = AnchorablesSource.FirstOrDefault(); } ActiveContent = newActive; } return(sucsess); }
private void ChangeActiveProfile(Dos2ModsSettings profile) { // FIXME bad check if (profile == null) { return; } //get old profile var id = profile.UUID; Profiles.FirstOrDefault(x => x.IsActive).IsActive = false; Profiles.FirstOrDefault(x => x.UUID == id).IsActive = true; //write to the lsb // FIXME I don't want this here //go into workspace view model and apply view if (AnchorablesSource != null) { WorkspaceViewModel wvm = (WorkspaceViewModel)AnchorablesSource.First(x => x.ContentId == "mods"); if (wvm != null) { wvm.ApplyModSettings(ActiveProfile); } } }
public void Refresh() { //Logging Start Logger.ProgressValue = 0; Logger.IsIndeterminate = true; Logger.Status = "Refreshing..."; Logger.Log = ""; IsInitialized = false; ModsList.Clear(); bool initProfiles = GetProfileInfo(); if (initProfiles) { WorkspaceViewModel wvm = (WorkspaceViewModel)AnchorablesSource.First(x => x.ContentId == "mods"); //FIXME check for updates wvm.GetModDataAsync(); Logger.LogString($"Refreshed Modlist."); } //Logging End Logger.ProgressValue = 100; Logger.IsIndeterminate = false; Logger.Status = "Finished."; Logger.NotifyStatusChanged(); }
public void NotifyModChanged() { if (AnchorablesSource != null) { ConflictsViewModel cvm = (ConflictsViewModel)AnchorablesSource.First(x => x.ContentId == "conflicts"); if (cvm != null) { cvm.RegenerateConflictsList(); } } }
public void Save() { WorkspaceViewModel wvm = (WorkspaceViewModel)AnchorablesSource.First(x => x.ContentId == "mods"); //var dbg = wvm.ModsCollectionView.CurrentItem; //wvm.ModsCollectionView.CommitEdit(); //wvm.ModsCollectionView.Refresh(); //Logging Start Logger.ProgressValue = 0; Logger.IsIndeterminate = true; Logger.Status = "Saving..."; Dos2.ModManager.Properties.Settings.Default.Save(); MessageBoxResult result = MessageBox.Show( "Save current load order? This operation cannot be undone.", "Save Load Order?", MessageBoxButton.OKCancel, MessageBoxImage.Warning); if (result == MessageBoxResult.OK) { lt.SaveModSettings(ActiveProfile, ModsList.ToList()); // refresh //FIXME this should be redundant bool initProfiles = GetProfileInfo(); if (initProfiles) { //FIXME check for updates wvm.GetModDataAsync(); } Logger.LogString($"Saved Modlist for profile {ActiveProfile.Name}."); } else { MessageBoxResult viper = MessageBox.Show("You'll coward don't even smoke crack."); // do noting } //Logging End Logger.ProgressValue = 100; Logger.IsIndeterminate = false; Logger.LogString("Finished Saving."); Logger.NotifyStatusChanged(); }
/// <summary> /// Add a layout item to this instance. /// </summary> /// <param name="item">The item to dock.</param> /// <param name="setAsActive">Set the item as the currenly active content.</param> public void AddLayoutItem(ILayoutItemViewModel item, bool setAsActive) { switch (item) { case IToolViewModel tool: AnchorablesSource.Add(tool); break; case IDocumentViewModel document: DocumentsSource.Add(document); break; default: return; } if (setAsActive) { ActiveContent = item; } }