Пример #1
0
        public async void ManageQueueTabs()
        {
            while (!CanManageQueue)
            {
                await Task.Delay(20);
            }

            if (CanManageQueue)
            {
                CanManageQueue = false;

                try
                {
                    if (GlobalVariables.CurrentIDs.ID_Tab != 0)
                    {
                        //Code content
                        string content = await ContentViewer.GetCode();

                        SerrisModulesServer.Manager.AsyncHelpers.RunSync(() => TabsWriteManager.PushTabContentViaIDAsync(GlobalVariables.CurrentIDs, content, false));

                        //Cursor position
                        PositionSCEE CursorPosition = await ContentViewer.GetCursorPosition();

                        InfosTab Tab = TabsAccessManager.GetTabViaID(GlobalVariables.CurrentIDs);
                        Tab.TabCursorPosition = new CursorPosition {
                            column = CursorPosition.column, row = CursorPosition.row
                        };
                        await TabsWriteManager.PushUpdateTabAsync(Tab, GlobalVariables.CurrentIDs.ID_TabsList, false);
                    }
                }
                catch { }

                foreach (CoreApplicationView view in CoreApplication.Views)
                {
                    if (Dispatcher != view.Dispatcher)
                    {
                        await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                        {
                            Messenger.Default.Send(new STSNotification {
                                Type = TypeUpdateTab.TabUpdated, ID = GlobalVariables.CurrentIDs
                            });
                        });
                    }
                }

                GlobalVariables.CurrentIDs = new TabID {
                    ID_Tab = Queue_Tabs[0].tabID, ID_TabsList = Queue_Tabs[0].tabsListID
                };
                ContentViewer.MonacoModelID        = Queue_Tabs[0].monacoModelID;
                ContentViewer.CursorPositionColumn = Queue_Tabs[0].cursorPositionColumn;
                ContentViewer.CursorPositionRow    = Queue_Tabs[0].cursorPositionLineNumber;
                ContentViewer.CodeLanguage         = Queue_Tabs[0].typeLanguage;
                ContentViewer.Code = Queue_Tabs[0].code;
                ChangePushed       = false;

                Queue_Tabs.RemoveAt(0);

                //Files opened with files associations
                if (FilesWasOpened && Queue_Tabs.Count == 0)
                {
                    await TabsCreatorAssistant.OpenFilesAlreadyOpenedAndCreateNewTabsFiles(GlobalVariables.CurrentIDs.ID_TabsList, OpenedFiles);

                    FilesWasOpened = false; OpenedFiles = null;
                }

                CanManageQueue = true;
            }
        }