コード例 #1
0
 public void SetActiveWorkspace(WorkspaceData viewnav)
 {
     if (collectionView != null)
     {
         collectionView.MoveCurrentTo(viewnav);
     }
 }
コード例 #2
0
        private void ExecuteShowHelpPageCommand(Object args)
        {
            WorkspaceData workspace = new WorkspaceData("", "HelpPageView", null, "About Page", true);

            Views.Add(workspace);
            SetActiveWorkspace(workspace);
        }
コード例 #3
0
ファイル: AbstractSettings.cs プロジェクト: zrolfs/pwiz
        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));
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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());
            });
        }
コード例 #7
0
ファイル: Workspace.cs プロジェクト: zrolfs/pwiz
        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);
            }
        }
コード例 #8
0
ファイル: Peptide.cs プロジェクト: zrolfs/pwiz
        public override PeptideData GetData(WorkspaceData workspaceData)
        {
            PeptideData peptideData;

            workspaceData.Peptides.TryGetValue(Id, out peptideData);
            return(peptideData);
        }
コード例 #9
0
        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;
            }
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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();
        }
コード例 #12
0
ファイル: WorkspaceTests.cs プロジェクト: krozen20/redshells
            public void EditWorkspaceTest()
            {
                WorkspaceData data = new WorkspaceData();
                bool actual = data.SaveWorkspace("home", "d:\\users");

                Assert.True(actual);
            }
コード例 #13
0
ファイル: MsDataFile.cs プロジェクト: zrolfs/pwiz
        public override MsDataFileData GetData(WorkspaceData workspaceData)
        {
            MsDataFileData msDataFileData;

            workspaceData.MsDataFiles.TryGetValue(Id, out msDataFileData);
            return(msDataFileData);
        }
コード例 #14
0
 void OnNotifyDataRecieved(WorkspaceData workspaceToRemove)
 {
     if (this.Views.Contains(workspaceToRemove))
     {
         this.Views.Remove(workspaceToRemove);
     }
 }
コード例 #15
0
ファイル: Workspace.cs プロジェクト: zrolfs/pwiz
 public Workspace(String path) : this()
 {
     _owner              = this;
     InstanceId          = Guid.NewGuid();
     DatabasePath        = path;
     DatabaseLock        = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
     _savedWorkspaceData = _data = new WorkspaceData();
 }
コード例 #16
0
        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));
        }
コード例 #17
0
 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();
 }
コード例 #18
0
ファイル: WorkspaceTests.cs プロジェクト: krozen20/redshells
            public void AddWorkspaceTest()
            {
                Fixture fixture = new Fixture();

                WorkspaceData data = new WorkspaceData();
                bool actual = data.SaveWorkspace(fixture.CreateAnonymous<string>(), "d:\\users");

                Assert.True(actual);
            }
コード例 #19
0
        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)));
        }
コード例 #20
0
        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;
            }
        }
コード例 #21
0
 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(),
     }));
 }
コード例 #22
0
        public override PeptideAnalysisData GetData(WorkspaceData workspaceData)
        {
            PeptideAnalysisData peptideAnalysisData = null;

            if (null != workspaceData.PeptideAnalyses)
            {
                workspaceData.PeptideAnalyses.TryGetValue(Id, out peptideAnalysisData);
            }
            return(peptideAnalysisData);
        }
コード例 #23
0
        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);
        }
コード例 #24
0
ファイル: Workspace.cs プロジェクト: zrolfs/pwiz
 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);
 }
コード例 #25
0
        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;
        }
コード例 #26
0
ファイル: Workspace.cs プロジェクト: zrolfs/pwiz
        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);
        }
コード例 #27
0
ファイル: Workspace.cs プロジェクト: zrolfs/pwiz
 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);
 }
コード例 #28
0
        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,
                });
            });
        }
コード例 #29
0
        private void ViewAwareStatusService_ViewLoaded()
        {
            if (Designer.IsInDesignMode)
            {
                return;
            }

            WorkspaceData workspace1 = new WorkspaceData("", "HomepageView", this.Views, "Home Page", false);

            Views.Add(workspace1);

            SetActiveWorkspace(workspace1);
        }
コード例 #30
0
ファイル: EntityModelList.cs プロジェクト: zrolfs/pwiz
        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)));
        }
コード例 #31
0
        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;
        }
コード例 #32
0
        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);
        }
コード例 #33
0
ファイル: WorkspaceTests.cs プロジェクト: krozen20/redshells
 public void GetWorkspaceTest()
 {
     WorkspaceData data = new WorkspaceData();
     Workspace workspace = data.GetWorkspace("home");
     Assert.NotNull(workspace);
 }
コード例 #34
0
ファイル: WorkspaceTests.cs プロジェクト: krozen20/redshells
 public void ClearWorkspacesTest()
 {
     WorkspaceData data = new WorkspaceData();
     data.Clear();
 }