public async void BackButtonPressed(object sender, RoutedEventArgs args) { Change change = await openChangeRef.GetChange(); VersionRef versionRef = change.ReleaseVersion; openChangeRef = null; ContentArea.GetInstance().OpenPage(ContentArea.PageType.Version, versionRef); }
public void Refresh(ChangeRef changeRef) { AdditionalDataExpander.IsExpanded = false; openChangeRef = changeRef; Change change = changeRef.GetChange().Result; versionRef = change.ReleaseVersion; VersionText.Text = $"Version: {change.ReleaseVersion.VersionName}"; eventBlock = true; ChangeTitleField.Text = change.Title; eventBlock = true; DescriptionField.Text = change.Description; if (change.AdditionalData == null) { change.AdditionalData = JObject.Parse("{}"); } eventBlock = true; AdditionalDataField.Text = change.AdditionalData.ToString(Newtonsoft.Json.Formatting.Indented); }
public void Duplicate(ChangeControl control) { int index = ChangeParent.Children.IndexOf(control); if (index == -1) { return; } VersionController versionController = MainWindow.GetInstance().VersionController; Version version = openVersionRef.GetVersion().Result; ChangeRef oldChangeRef = version.Changes[index]; string guid = Guid.NewGuid().ToString(); string relativePath = Path.Combine(version.VersionName, "changes", $"{guid}.json"); ChangeRef newChangeRef = new ChangeRef(versionController, guid, relativePath); version.Changes.Insert(index + 1, newChangeRef); Change oldChange = oldChangeRef.GetChange(false).Result; VersionRef releaseVersion = new VersionRef(versionController, oldChange.ReleaseVersion.RelativeFilePath, oldChange.ReleaseVersion.VersionName); Change newChange = new Change(versionController, guid, relativePath, oldChange.Title, oldChange.Description, releaseVersion); if (oldChange.AdditionalData != null) { newChange.AdditionalData = (JObject)oldChange.AdditionalData.DeepClone(); } versionController.CacheChange(newChange); ChangeControl newControl = new ChangeControl(newChangeRef); ChangeParent.Children.Insert(index + 1, newControl); }
public ChangeControl(ChangeRef changeRef) { InitializeComponent(); ChangeTitle.Text = changeRef.GetChange(false).Result.Title; }