/// <summary> /// Handles the Click event of the BtnSaveSelected control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> /// <remarks>Runs on the UI thread.</remarks> private void BtnSaveSelected_Click(object sender, RoutedEventArgs e) { MetaPropWindow win; ResourceTreeView.State state; if (ResourceTree.Selected == null) { MessageBox.Show("You must select a resource first."); return; } win = new MetaPropWindow(ResourceTree.Selected.Guid, FileSystem, _couchdb); if (!win.ShowDialog().Value) return; // Reload the meta ResourceTree.Selected.MetaAsset.LoadFromLocal(null, Common.FileSystem.Path.RelativeMetaPath + ResourceTree.Selected.Guid.ToString("N") + ".xml", FileSystem); lock (IdTranslation) { IdTranslation.Add(ResourceTree.Selected.Guid, Guid.Empty); } state = ResourceTree.StartSaveToRemote(ResourceTree.Selected); // If this resource does not exist on the server then create, else update if (state.IsCreating) _workMaster.AddJob(new JobArgs() { CouchDB = _couchdb, ErrorManager = ErrorManager, FileSystem = FileSystem, JobType = Master.JobType.CreateResource, RequestingUser = TEMP_USERNAME, Requestor = this, Resource = state.Resource, Timeout = 100000, UpdateUICallback = CreateResourceCallback }); else _workMaster.AddJob(new JobArgs() { CouchDB = _couchdb, ErrorManager = ErrorManager, FileSystem = FileSystem, JobType = Master.JobType.SaveResource, RequestingUser = TEMP_USERNAME, Requestor = this, Resource = state.Resource, Timeout = 100000, UpdateUICallback = SaveResourceCallback }); }
/// <summary> /// Handles the Click event of the BtnSaveSelected control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> /// <remarks>Runs on the UI thread.</remarks> private void BtnSaveSelected_Click(object sender, RoutedEventArgs e) { MetaPropWindow win; ResourceTreeView.State state; if (ResourceTree.Selected == null) { MessageBox.Show("You must select a resource first."); return; } win = new MetaPropWindow(ResourceTree.Selected.Guid, FileSystem, _couchdb); if (!win.ShowDialog().Value) { return; } // Reload the meta ResourceTree.Selected.MetaAsset.LoadFromLocal(null, Common.FileSystem.Path.RelativeMetaPath + ResourceTree.Selected.Guid.ToString("N") + ".xml", FileSystem); lock (IdTranslation) { IdTranslation.Add(ResourceTree.Selected.Guid, Guid.Empty); } state = ResourceTree.StartSaveToRemote(ResourceTree.Selected); // If this resource does not exist on the server then create, else update if (state.IsCreating) { _workMaster.AddJob(new JobArgs() { CouchDB = _couchdb, ErrorManager = ErrorManager, FileSystem = FileSystem, JobType = Master.JobType.CreateResource, RequestingUser = TEMP_USERNAME, Requestor = this, Resource = state.Resource, Timeout = 100000, UpdateUICallback = CreateResourceCallback }); } else { _workMaster.AddJob(new JobArgs() { CouchDB = _couchdb, ErrorManager = ErrorManager, FileSystem = FileSystem, JobType = Master.JobType.SaveResource, RequestingUser = TEMP_USERNAME, Requestor = this, Resource = state.Resource, Timeout = 100000, UpdateUICallback = SaveResourceCallback }); } }