示例#1
0
        private async void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

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

                    await 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);

                    deferral.Complete();
                }
                else
                {
                    deferral.Complete();
                }
            }
            catch
            {
                deferral.Complete();
            }
        }
示例#2
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);

                CanManageQueue = true;
            }
        }
 ///<summary>
 ///Set the cursor position on the document - ex: component_name.SetCursorPosition(new PositionSCEE {row = 1, column = 1});
 ///</summary>
 public async void SetCursorPosition(PositionSCEE pos)
 {
     if (Initialized)
     {
         string[] set_code = { $"editor.setPosition(new monaco.Position({pos.row},{pos.column}));" };
         await editor_view.InvokeScriptAsync("eval", set_code);
     }
 }