public void SetActiveWorkspace(WorkspaceData viewnav) { if (collectionView != null) { collectionView.MoveCurrentTo(viewnav); } }
private void ExecuteShowHelpPageCommand(Object args) { WorkspaceData workspace = new WorkspaceData("", "HelpPageView", null, "About Page", true); Views.Add(workspace); SetActiveWorkspace(workspace); }
public virtual WorkspaceData Merge(WorkspaceData newWorkspaceData) { var myList = Data; var theirList = GetData(newWorkspaceData); var baseList = GetData(Workspace.SavedData); if (null == myList || Equals(baseList, myList)) { return(newWorkspaceData); } if (null == theirList || null == baseList || Equals(theirList, baseList)) { return(SetData(newWorkspaceData, myList)); } var myChanges = new HashSet <KeyValuePair <TKey, TValue> >(Data); myChanges.SymmetricExceptWith(SavedData); var myChangedKeys = new HashSet <TKey>(myChanges.Select(pair => pair.Key)).Distinct(); var newValues = new List <KeyValuePair <TKey, TValue> >(Data.Where(pair => myChangedKeys.Contains(pair.Key))); newValues.AddRange(theirList.Where(pair => !myChangedKeys.Contains(pair.Key))); var mergedData = ImmutableSortedList.FromValues(newValues, Data.KeyComparer); return(SetData(newWorkspaceData, mergedData)); }
public void SetData(WorkspaceData workspaceData) { var dataFileIds = _alignments.Keys.Select(key => key.FromId) .Concat(_alignments.Keys.Select(key => key.ToId)) .Distinct() .ToArray(); var changedDataFileIds = new HashSet <long>(); foreach (var dataFileId in dataFileIds) { if (!Equals(GetRetentionTimes(dataFileId), GetRetentionTimes(workspaceData, dataFileId))) { changedDataFileIds.Add(dataFileId); } } if (changedDataFileIds.Count > 0) { _alignments = ImmutableSortedList.FromValues( _alignments.Where(pair => !changedDataFileIds.Contains(pair.Key.FromId) && !changedDataFileIds.Contains(pair.Key.ToId))); } WorkspaceData = workspaceData; }
public static WorkspaceData Import(this WorkspaceJson json, IDataStoreContext ctx, Guid?localIdHint = null, WorkspaceData mergeBase = null) { var converter = ServiceContainer.Resolve <WorkspaceJsonConverter> (); return(converter.Import(ctx, json, localIdHint, mergeBase)); }
public override void SetUp() { base.SetUp(); RunAsync(async delegate { workspace = await DataStore.PutAsync(new WorkspaceData() { Name = "Test", }); user = await DataStore.PutAsync(new UserData() { Name = "John Doe", TrackingMode = TrackingMode.StartNew, DefaultWorkspaceId = workspace.Id, }); await SetUpFakeUser(user.Id); var activeManager = new ActiveTimeEntryManager(); await Util.AwaitPredicate(() => activeManager.ActiveTimeEntry != null); ServiceContainer.Register <ExperimentManager> (new ExperimentManager()); ServiceContainer.Register <ISyncManager> (Mock.Of <ISyncManager> (mgr => !mgr.IsRunning)); ServiceContainer.Register <ActiveTimeEntryManager> (activeManager); ServiceContainer.Register <ITracker> (() => new FakeTracker()); }); }
public void SetData(WorkspaceData data, WorkspaceData savedData) { if (Equals(Data, data) && Equals(SavedData, savedData)) { return; } var workspaceChange = new WorkspaceChangeArgs(Data, SavedData); _data = data; _savedWorkspaceData = savedData; _tracerDefList = null; RetentionTimeAlignments.SetData(Data); Settings.Update(workspaceChange); Modifications.Update(workspaceChange); TracerDefs.Update(workspaceChange); Peptides.Update(workspaceChange); MsDataFiles.Update(workspaceChange); PeptideAnalyses.Update(workspaceChange); var changeHandlers = Change; if (null != changeHandlers) { changeHandlers(this, workspaceChange); } }
public override PeptideData GetData(WorkspaceData workspaceData) { PeptideData peptideData; workspaceData.Peptides.TryGetValue(Id, out peptideData); return(peptideData); }
private void _backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { throw e.Error; } else { SQLScript = e.Result as string; WorkspaceData workspace2 = new WorkspaceData("", "TablesView", SQLScript, "DB Script", true); ViewsLocal.Add(workspace2); WorkspaceData workspace3 = new WorkspaceData("", "IndexesView", cn.SQLScriptIndexes, "Indexes", true); ViewsLocal.Add(workspace3); WorkspaceData workspace4 = new WorkspaceData("", "ForeignKeysView", cn.SQLScriptForeignKeysDrop + Environment.NewLine + cn.SQLScriptForeignKeysAdd, "Foreign Keys", true); ViewsLocal.Add(workspace4); WorkspaceData workspace5 = new WorkspaceData("", "TriggersView", cn.SQLScriptTriggers, "Triggers", true); ViewsLocal.Add(workspace5); WorkspaceData workspace6 = new WorkspaceData("", "StoredProcsView", cn.SQLScriptStoredProcs, "Stored Procs", true); ViewsLocal.Add(workspace6); WorkspaceData workspace7 = new WorkspaceData("", "DBViewsView", cn.SQLScriptViews, "Views", true); ViewsLocal.Add(workspace7); SetActiveWorkspace(workspace2); IsLoading = false; } }
public void GetParentWebId_Should_ReturnExpectedResult() { // Arrange const string Url = "https://dummy.org/url"; ShimSPWeb.AllInstances.ListsGet = _ => new ShimSPListCollection { ItemGetGuid = guid => new ShimSPList { GetItemByIdInt32 = id => new ShimSPListItem { ItemGetString = name => Url } } }; ShimSPSite.ConstructorString = (_, url) => { }; ShimSPWeb.AllInstances.IDGet = _ => DummyGuid; ShimSPWeb.AllInstances.ExistsGet = _ => true; // Act var result = WorkspaceData.GetParentWebId(DummyGuid, DummyGuid, DummyGuid, 1); // Assert Assert.IsNotNull(result); Assert.AreEqual(DummyGuid, result); }
public MainWindowViewModel(IViewAwareStatus viewAwareStatusService, IMessageBoxService messageBoxService) { this.viewAwareStatusService = viewAwareStatusService; this.viewAwareStatusService.ViewLoaded += ViewAwareStatusService_ViewLoaded; this.MessageBoxService = messageBoxService; this.UIVisualizerService = ViewModelRepository.Instance.Resolver.Container.GetExport <IUIVisualizerService>().Value; this.DisplayName = "Main Window"; this.ViewProfileCommand = new CommandBase <User>(o => this.ExecuteViewProfileCommand(o)); if (Designer.IsInDesignMode) { return; } // add view WorkspaceData workspace = new WorkspaceData(@"/XRMS.Presentation;component/Images/Cashier.png", "CashierOrdersView", null, "Orders Management", false); Views.Add(workspace); SetActiveWorkspace(workspace); _refreshingTimer = new DispatcherTimer(); _refreshingTimer.Tick += new EventHandler(OnRefreshingData); _refreshingTimer.Interval = TimeSpan.FromMilliseconds(1000); _refreshingTimer.Start(); ReadRestaurantInfo(); }
public void EditWorkspaceTest() { WorkspaceData data = new WorkspaceData(); bool actual = data.SaveWorkspace("home", "d:\\users"); Assert.True(actual); }
public override MsDataFileData GetData(WorkspaceData workspaceData) { MsDataFileData msDataFileData; workspaceData.MsDataFiles.TryGetValue(Id, out msDataFileData); return(msDataFileData); }
void OnNotifyDataRecieved(WorkspaceData workspaceToRemove) { if (this.Views.Contains(workspaceToRemove)) { this.Views.Remove(workspaceToRemove); } }
public Workspace(String path) : this() { _owner = this; InstanceId = Guid.NewGuid(); DatabasePath = path; DatabaseLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); _savedWorkspaceData = _data = new WorkspaceData(); }
public override WorkspaceData SetData(WorkspaceData workspaceData, PeptideFileAnalysisData value) { var peptideAnalysisData = PeptideAnalysis.GetData(workspaceData); peptideAnalysisData = peptideAnalysisData.SetFileAnalyses(peptideAnalysisData.FileAnalyses.Replace(Id, value)); return(PeptideAnalysis.SetData(workspaceData, peptideAnalysisData)); }
public void Save() { WorkspaceData.DataSources.Clear(); WorkspaceData.DataSources.AddRange( AvailableDataSources.Select(child => new WorkspaceEntry { LoaderData = child.LoadData, LoaderKey = child.LoaderKey, FormatType = child.FormatType })); WorkspaceData.Save(); }
public void AddWorkspaceTest() { Fixture fixture = new Fixture(); WorkspaceData data = new WorkspaceData(); bool actual = data.SaveWorkspace(fixture.CreateAnonymous<string>(), "d:\\users"); Assert.True(actual); }
protected override WorkspaceData SetData(WorkspaceData workspaceData, ImmutableSortedList <long, PeptideFileAnalysisData> data) { PeptideAnalysisData peptideAnalysisData; workspaceData.PeptideAnalyses.TryGetValue(PeptideAnalysis.Id, out peptideAnalysisData); peptideAnalysisData = peptideAnalysisData.SetFileAnalyses(data); return(workspaceData.SetPeptideAnalyses(workspaceData.PeptideAnalyses .Replace(PeptideAnalysis.Id, peptideAnalysisData))); }
private void _generateScriptsBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { throw e.Error; } else { SQLScript = e.Result as string; if (cn.objectsToScriptOptions.ScriptTables) { WorkspaceData workspace2 = new WorkspaceData("", "DisplayScriptView", SQLScript, "Tables", true); Views.Add(workspace2); SetActiveWorkspace(workspace2); CreateRightClickContextMenus2(); } if (cn.objectsToScriptOptions.ScriptIndexes) { WorkspaceData workspace3 = new WorkspaceData("", "DisplayScriptView", cn.SQLScriptIndexes, "Indexes", true); Views.Add(workspace3); SetActiveWorkspace(workspace3); } if (cn.objectsToScriptOptions.ScriptForeignKeys) { WorkspaceData workspace4 = new WorkspaceData("", "DisplayScriptView", cn.SQLScriptForeignKeysDrop + Environment.NewLine + cn.SQLScriptForeignKeysAdd, "Foreign Keys", true); Views.Add(workspace4); SetActiveWorkspace(workspace4); } if (cn.objectsToScriptOptions.ScriptTriggers) { WorkspaceData workspace5 = new WorkspaceData("", "DisplayScriptView", cn.SQLScriptTriggers, "Triggers", true); Views.Add(workspace5); SetActiveWorkspace(workspace5); } if (cn.objectsToScriptOptions.ScriptStoredProcs) { WorkspaceData workspace6 = new WorkspaceData("", "DisplayScriptView", cn.SQLScriptStoredProcs, "Stored Procs", true); Views.Add(workspace6); SetActiveWorkspace(workspace6); } if (cn.objectsToScriptOptions.ScriptViews) { WorkspaceData workspace7 = new WorkspaceData("", "DisplayScriptView", cn.SQLScriptViews, "Views", true); Views.Add(workspace7); SetActiveWorkspace(workspace7); } IsLoading = false; } }
public Workspace(WorkspaceData dataObject) { this.dataObject = dataObject; projects.Add(new Project(dataObject)); projects.Add(new Project(new ProjectData() { WorkspaceId = dataObject.Id, Color = new Random().Next(), })); }
public override PeptideAnalysisData GetData(WorkspaceData workspaceData) { PeptideAnalysisData peptideAnalysisData = null; if (null != workspaceData.PeptideAnalyses) { workspaceData.PeptideAnalyses.TryGetValue(Id, out peptideAnalysisData); } return(peptideAnalysisData); }
public override PeptideFileAnalysisData GetData(WorkspaceData workspaceData) { var peptideAnalysisData = PeptideAnalysis.GetData(workspaceData); PeptideFileAnalysisData peptideFileAnalysisData = null; if (null != peptideAnalysisData) { peptideAnalysisData.FileAnalyses.TryGetValue(Id, out peptideFileAnalysisData); } return(peptideFileAnalysisData); }
private Workspace() { _data = _savedWorkspaceData = new WorkspaceData(); Modifications = new Modifications(this); Settings = new WorkspaceSettings(this); TracerDefs = new TracerDefs(this); PeptideAnalyses = new PeptideAnalyses(this); Peptides = new Peptides(this); MsDataFiles = new MsDataFiles(this); RetentionTimeAlignments = new RetentionTimeAlignments(Data); }
private void ExecuteScriptDataCommand(Object args) { Microsoft.SqlServer.Management.Smo.Table selectedTable = (Microsoft.SqlServer.Management.Smo.Table)args; WorkspaceData workspace = new WorkspaceData("", "ScriptTableDataView", selectedTable, "Data", true); Views.Add(workspace); SetActiveWorkspace(workspace); ShowContextMenu = false; }
public void Merge(WorkspaceData newData) { var newSavedData = newData; newData = Settings.Merge(newData); newData = Modifications.Merge(newData); newData = TracerDefs.Merge(newData); newData = Peptides.Merge(newData); newData = MsDataFiles.Merge(newData); newData = PeptideAnalyses.Merge(newData); SetData(newData, newSavedData); }
public Workspace(Workspace workspace) : this() { _owner = workspace._owner; InstanceId = workspace.InstanceId; DatabasePath = workspace.DatabasePath; DatabaseLock = workspace.DatabaseLock; _tpgLinkDef = workspace.TpgLinkDef; _data = workspace._data; _savedWorkspaceData = workspace._savedWorkspaceData; RetentionTimeAlignments = new RetentionTimeAlignments(Data); RetentionTimeAlignments.MergeFrom(workspace.RetentionTimeAlignments); }
private void CreateTestData() { RunAsync(async delegate { workspace = await DataStore.PutAsync(new WorkspaceData() { RemoteId = 1, Name = "Unit Testing", IsDirty = true, }); user = await DataStore.PutAsync(new UserData() { RemoteId = 1, Name = "Tester", DefaultWorkspaceId = workspace.Id, IsDirty = true, }); var project = await DataStore.PutAsync(new ProjectData() { RemoteId = 1, Name = "Ad design", WorkspaceId = workspace.Id, IsDirty = true, }); await DataStore.PutAsync(new TimeEntryData() { RemoteId = 1, Description = "Initial concept", State = TimeEntryState.Finished, StartTime = new DateTime(2013, 01, 01, 09, 12, 0, DateTimeKind.Utc), StopTime = new DateTime(2013, 01, 01, 10, 1, 0, DateTimeKind.Utc), ProjectId = project.Id, WorkspaceId = workspace.Id, UserId = user.Id, IsDirty = true, }); await DataStore.PutAsync(new TimeEntryData() { RemoteId = 2, Description = "Breakfast", State = TimeEntryState.Finished, StartTime = new DateTime(2013, 01, 01, 10, 12, 0, DateTimeKind.Utc), StopTime = new DateTime(2013, 01, 01, 10, 52, 0, DateTimeKind.Utc), WorkspaceId = workspace.Id, UserId = user.Id, IsDirty = true, }); }); }
private void ViewAwareStatusService_ViewLoaded() { if (Designer.IsInDesignMode) { return; } WorkspaceData workspace1 = new WorkspaceData("", "HomepageView", this.Views, "Home Page", false); Views.Add(workspace1); SetActiveWorkspace(workspace1); }
public virtual WorkspaceData Merge(WorkspaceData newData) { var baseList = GetData(Workspace.SavedData); var myList = GetData(Workspace.Data); var theirList = GetData(newData); if (myList == null) { return(newData); } if (baseList == null || theirList == null) { return(SetData(newData, myList)); } if (Equals(baseList, theirList) || Equals(myList, theirList)) { return(SetData(newData, myList)); } var mergedList = new Dictionary <TKey, TData>(myList.AsDictionary()); foreach (var entry in theirList) { TData myData; if (!mergedList.TryGetValue(entry.Key, out myData)) { mergedList.Add(entry.Key, entry.Value); continue; } TData baseData; if (baseList.TryGetValue(entry.Key, out baseData)) { if (!CheckDirty(baseData, myData)) { mergedList[entry.Key] = entry.Value; } else { if (CheckDirty(myData, entry.Value)) { Console.Out.WriteLine("Unable to merge {0}", entry.Key); } } } } foreach (var deletedKey in baseList.Keys.Except(theirList.Keys)) { mergedList.Remove(deletedKey); } return(SetData(newData, ImmutableSortedList.FromValues(mergedList, theirList.KeyComparer))); }
private void RadComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { WorkspaceData selectedItem = workspaceComboBox.SelectedItem as WorkspaceData; this.selectedWorkspace = selectedItem; if (selectedWorkspace != null) { btnNavigate.IsEnabled = true; } WorkspaceName.Text = selectedItem.WorkspaceName; WorkspaceRole.Text = selectedItem.WorkspaceRole; PlatformName.Text = selectedItem.PlatformName; PlatformRole.Text = selectedItem.PlatformRole; }
private static void ImportJson(WorkspaceData data, WorkspaceJson json) { data.Name = json.Name; data.IsPremium = json.IsPremium; data.DefaultRate = json.DefaultRate; data.DefaultCurrency = json.DefaultCurrency; data.ProjectCreationPrivileges = json.OnlyAdminsMayCreateProjects ? AccessLevel.Admin : AccessLevel.Regular; data.BillableRatesVisibility = json.OnlyAdminsSeeBillableRates ? AccessLevel.Admin : AccessLevel.Regular; data.RoundingMode = json.RoundingMode; data.RoundingPercision = json.RoundingPercision; data.LogoUrl = json.LogoUrl; ImportCommonJson(data, json); }
public void GetWorkspaceTest() { WorkspaceData data = new WorkspaceData(); Workspace workspace = data.GetWorkspace("home"); Assert.NotNull(workspace); }
public void ClearWorkspacesTest() { WorkspaceData data = new WorkspaceData(); data.Clear(); }