private async void Tabs_Drop(object sender, DragEventArgs e)
 {
     if (e.DataView.Contains(StandardDataFormats.StorageItems))
     {
         await TabsCreatorAssistant.OpenFilesAlreadyOpenedAndCreateNewTabsFiles(GlobalVariables.CurrentIDs.ID_TabsList, await e.DataView.GetStorageItemsAsync());
     }
 }
Exemple #2
0
        private async void ContentViewer_EditorCodeLoaded(object sender, EventArgs e)
        {
            if (!EditorIsReady)
            {
                EditorIsReady = true;
            }

            if (FilesWasOpened)
            {
                await TabsCreatorAssistant.OpenFilesAlreadyOpenedAndCreateNewTabsFiles(GlobalVariables.CurrentIDs.ID_TabsList, OpenedFiles);

                FilesWasOpened = false;
            }
        }
Exemple #3
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var args = e.Parameter as Windows.ApplicationModel.Activation.IActivatedEventArgs;

            if (args != null)
            {
                if (args.Kind == Windows.ApplicationModel.Activation.ActivationKind.File)
                {
                    var fileArgs = args as Windows.ApplicationModel.Activation.FileActivatedEventArgs;

                    if (EditorIsReady)
                    {
                        await TabsCreatorAssistant.OpenFilesAlreadyOpenedAndCreateNewTabsFiles(GlobalVariables.CurrentIDs.ID_TabsList, fileArgs.Files);
                    }
                    else
                    {
                        OpenedFiles    = fileArgs.Files;
                        FilesWasOpened = true;
                    }
                }
            }
        }
Exemple #4
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;
            }
        }
        protected override async void OnFileActivated(FileActivatedEventArgs args)
        {
            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                GlobalVariables.GlobalizationRessources = new ResourceLoader();
                SMSInitialize.InitializeSMSJson();
                GlobalVariables.CurrentTheme = await new ThemeReader(ModulesAccessManager.GetCurrentThemeID()).GetThemeBrushesContent();

                Messenger.Default.Register <SMSNotification>(this, async(notification) =>
                {
                    try
                    {
                        switch (notification.Type)
                        {
                        case TypeUpdateModule.CurrentThemeUpdated:
                            GlobalVariables.CurrentTheme = await new ThemeReader(notification.ID).GetThemeBrushesContent();
                            Messenger.Default.Send(new EditorViewNotification {
                                ID = 0, type = EditorViewNotificationType.UpdateUI
                            });
                            break;
                        }
                    }
                    catch { }
                });

                Messenger.Default.Register <TempContentNotification>(this, (notification) =>
                {
                    try
                    {
                        switch (notification.type)
                        {
                        case TempContentType.currentIDs when !notification.answerNotification:
                            Messenger.Default.Send(new TempContentNotification {
                                answerNotification = true, type = TempContentType.currentIDs, content = GlobalVariables.CurrentIDs
                            });
                            break;

                        case TempContentType.currentDevice when !notification.answerNotification:
                            Messenger.Default.Send(new TempContentNotification {
                                answerNotification = true, type = TempContentType.currentDevice, content = GlobalVariables.CurrentDevice
                            });
                            break;

                        case TempContentType.currentTheme when !notification.answerNotification:
                            Messenger.Default.Send(new TempContentNotification {
                                answerNotification = true, type = TempContentType.currentTheme, content = GlobalVariables.CurrentTheme
                            });
                            break;
                        }
                    }
                    catch { }
                });

                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Window.Current.Content = rootFrame;

                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(EditorView), args);
                }
                Window.Current.Activate();
            }
            else
            {
                await TabsCreatorAssistant.OpenFilesAlreadyOpenedAndCreateNewTabsFiles(GlobalVariables.CurrentIDs.ID_TabsList, args.Files);
            }
        }