コード例 #1
0
        public void CreateStartPages(Dictionary <Guid, IStoryboardPageContext> startPageContexts = null)
        {
            if (IsStartPagesCreated)
            {
                throw new InvalidOperationException("Start pages have been alread created");
            }

            Invoker.Invoke(() =>
            {
                foreach (var storyboard in Storyboards)
                {
                    var startPageInfo =
                        RegisteredPages.Keys.FirstOrDefault(x => x.IsStartPage && x.StoryboardId == storyboard.Key);
                    if (startPageInfo == null)
                    {
                        throw new InvalidOperationException(
                            $"Start page for storyboard {storyboard.Key} not registered");
                    }

                    var view = CreatePageView(startPageInfo);
                    storyboard.Value.ActivePage = view;
                    StartPagesOpenningStat[startPageInfo.PageUniqueId] = false;
                    IStoryboardPageContext context = null;
                    startPageContexts?.TryGetValue(startPageInfo.PageId, out context);
                    StartPageContexts[startPageInfo.PageUniqueId] = context;
                    PageContexts[startPageInfo.PageUniqueId]      = context;
                }

                IsStartPagesCreated = true;
            });
        }
コード例 #2
0
        public IDeviceControllerConfigViewModel GetViewModel(Guid deviceId)
        {
            if (!_deviceModules.ContainsKey(deviceId))
            {
                throw new ArgumentException($"No device with id {deviceId}");
            }

            var module = _deviceModules[deviceId];

            return(_uiInvoker.Invoke(() => _container.GetInstance(module.DeviceControllerConfigViewModel) as IDeviceControllerConfigViewModel));
        }