示例#1
0
        void PerformRefreshList()
        {
            LoginUtility.RequestFullLicenseInfo();
            Thread.Sleep(500);

            UpdateList();

            Thread thread1 = new Thread(ThreadGetStoreItems);

            thread1.Start();
        }
示例#2
0
        private void EditorForm_Load(object sender, EventArgs e)
        {
            if (EditorUtility.IsDesignerHosted(this))
            {
                return;
            }

            //hide ribbon to avoid redrawing
            kryptonRibbon.Visible = false;

            // create cover
            coverControl           = new Control();
            coverControl.BackColor = Color.FromArgb(40, 40, 40);
            // 127, 127, 127 );
            //coverControl.BackColor = DarkTheme ? Color.FromArgb( 40, 40, 40 ) : Color.FromArgb( 42, 87, 154 );
            //coverControl.BackColor = Color.Black;
            coverControl.Dock = DockStyle.Fill;
            Controls.Add(coverControl);
            coverControl.BringToFront();
            Application.DoEvents();

            //dpi
            try
            {
                using (Graphics graphics = CreateGraphics())
                {
                    dpi = graphics.DpiX;
                }
            }
            catch (Exception ex)
            {
                dpi = 96;
                Log.Warning("EditorForm: CreateGraphics: Call failed. " + ex.Message);
            }

            kryptonRibbon.RibbonTabs.Clear();

            {
                EngineApp.InitSettings.UseApplicationWindowHandle = Handle;

                if (!EngineApp.Create())
                {
                    Log.Fatal("EngineApp.Create() failed.");
                    Close();
                    return;
                }

                //эксепшен не генегируется, просто падает

                //bool created = false;

                //if( Debugger.IsAttached )
                //	created = EngineApp.Create();
                //else
                //{
                //	try
                //	{
                //		//!!!!
                //		Log.Info( "dd" );

                //		created = EngineApp.Create();

                //		//!!!!
                //		Log.Info( "tt" );

                //	}
                //	catch( Exception e2 )
                //	{
                //		//!!!!
                //		Log.Info( "ee" );

                //		Log.FatalAsException( e2.ToString() );
                //	}
                //}

                //if( !created )
                //{
                //	Log.Fatal( "EngineApp.Create() failed." );
                //	Close();
                //	return;
                //}
            }

            EngineApp.DefaultSoundChannelGroup.Volume = 0;

            //set theme
            if (ProjectSettings.Get.Theme.Value == Component_ProjectSettings.ThemeEnum.Dark)
            {
                kryptonManager.GlobalPaletteMode = PaletteModeManager.NeoAxisBlack;
            }
            else
            {
                kryptonManager.GlobalPaletteMode = PaletteModeManager.NeoAxisBlue;
            }

            KryptonDarkThemeUtility.DarkTheme = EditorAPI.DarkTheme;
            if (EditorAPI.DarkTheme)
            {
                EditorAssemblyInterface.Instance.SetDarkTheme();
            }

            Aga.Controls.Tree.NodeControls.BaseTextControl.DarkTheme = EditorAPI.DarkTheme;

            //app button
            kryptonRibbon.RibbonAppButton.AppButtonText = EditorLocalization.Translate("AppButton", kryptonRibbon.RibbonAppButton.AppButtonText);
            if (DarkTheme)
            {
                kryptonRibbon.RibbonAppButton.AppButtonBaseColorDark  = Color.FromArgb(40, 40, 40);
                kryptonRibbon.RibbonAppButton.AppButtonBaseColorLight = Color.FromArgb(54, 54, 54);
            }

            //!!!! default editor layout:

            // IsSystemWindow = true for this:
            // для этих "системных" окон используется отдельная логика сериализации (окна создаются до загрузки конфига)
            // и отдельная логика закрытия (hide/remove)
            workspaceController.AddToDockspaceStack(new DockWindow[] { new ObjectsWindow(), new SettingsWindow() }, DockingEdge.Right);
            //workspaceController.AddDockspace(new MembersWindow(), "Members", DockingEdge.Right, new Size(300, 300));
            workspaceController.AddToDockspaceStack(new DockWindow[] { new ResourcesWindow(), new SolutionExplorer(), new PreviewWindow() }, DockingEdge.Left);
            workspaceController.AddToDockspace(new DockWindow[] { new MessageLogWindow(), new OutputWindow(), new DebugInfoWindow() }, DockingEdge.Bottom);

            //!!!!
            //workspaceController.AddDockWindow( new TipsWindow(), true, false );

            //!!!!эвент чтобы свои добавлять. и пример

            //load docking state
            {
                string configFile = VirtualPathUtility.GetRealPathByVirtual(dockingConfigFileName);
                //default settings
                if (!File.Exists(configFile))
                {
                    configFile = VirtualPathUtility.GetRealPathByVirtual(dockingConfigFileNameDefault);
                }

                if (File.Exists(configFile))
                {
                    //try
                    //{
                    ////!!!! If xml broken, we will not get an exception.
                    //// the exception is swallowed inside the krypton.
                    //// how do I know if an error has occurred?
                    workspaceController.LoadLayoutFromFile(configFile);
                    //}
                    //	catch
                    //	{
                    //		//!!!!TODO: layout broken. fix this!
                    //	}
                }
            }

            InitQAT();
            InitRibbon();

            UpdateText();

            //apply editor settings
            EditorSettingsSerialization.InitAfterFormLoad();

            XmlDocumentationFiles.PreloadBaseAssemblies();

            EditorAPI.SelectedDocumentWindowChanged += EditorAPI_SelectedDocumentWindowChanged;

            UpdateRecentProjectsInRegistry();

            LoginUtility.RequestFullLicenseInfo();

            loaded = true;
        }
示例#3
0
        private void EditorForm_Load(object sender, EventArgs e)
        {
            if (WinFormsUtility.IsDesignerHosted(this))
            {
                return;
            }

            //hide ribbon to avoid redrawing
            kryptonRibbon.Visible = false;

            // create cover
            coverControl           = new Control();
            coverControl.BackColor = Color.FromArgb(40, 40, 40);
            coverControl.Dock      = DockStyle.Fill;
            Controls.Add(coverControl);
            coverControl.BringToFront();
            Application.DoEvents();

            ////dpi
            //try
            //{
            //	using( Graphics graphics = CreateGraphics() )
            //	{
            //		dpi = graphics.DpiX;
            //	}
            //}
            //catch( Exception ex )
            //{
            //	dpi = 96;
            //	Log.Warning( "EditorForm: CreateGraphics: Call failed. " + ex.Message );
            //}

            kryptonRibbon.RibbonTabs.Clear();

            {
                EngineApp.InitSettings.UseApplicationWindowHandle = Handle;

                if (!EngineApp.Create())
                {
                    Log.Fatal("EngineApp.Create() failed.");
                    Close();
                    return;
                }

                //эксепшен не генегируется, просто падает

                //bool created = false;

                //if( Debugger.IsAttached )
                //	created = EngineApp.Create();
                //else
                //{
                //	try
                //	{
                //		//!!!!
                //		Log.Info( "dd" );

                //		created = EngineApp.Create();

                //		//!!!!
                //		Log.Info( "tt" );

                //	}
                //	catch( Exception e2 )
                //	{
                //		//!!!!
                //		Log.Info( "ee" );

                //		Log.FatalAsException( e2.ToString() );
                //	}
                //}

                //if( !created )
                //{
                //	Log.Fatal( "EngineApp.Create() failed." );
                //	Close();
                //	return;
                //}
            }

            EngineApp.DefaultSoundChannelGroup.Volume = 0;

            EnableLocalization();
            PreviewImagesManager.Init();

            //set theme
            if (ProjectSettings.Get.Theme.Value == Component_ProjectSettings.ThemeEnum.Dark)
            {
                kryptonManager.GlobalPaletteMode = PaletteModeManager.NeoAxisBlack;
            }
            else
            {
                kryptonManager.GlobalPaletteMode = PaletteModeManager.NeoAxisBlue;
            }

            KryptonDarkThemeUtility.DarkTheme = EditorAPI.DarkTheme;
            if (EditorAPI.DarkTheme)
            {
                EditorAssemblyInterface.Instance.SetDarkTheme();
            }
            Aga.Controls.Tree.NodeControls.BaseTextControl.DarkTheme = EditorAPI.DarkTheme;

            BackColor = EditorAPI.DarkTheme ? Color.FromArgb(40, 40, 40) : Color.FromArgb(240, 240, 240);

            //app button
            kryptonRibbon.RibbonAppButton.AppButtonText = EditorLocalization.Translate("AppButton", kryptonRibbon.RibbonAppButton.AppButtonText);
            if (DarkTheme)
            {
                kryptonRibbon.RibbonAppButton.AppButtonBaseColorDark  = Color.FromArgb(40, 40, 40);
                kryptonRibbon.RibbonAppButton.AppButtonBaseColorLight = Color.FromArgb(54, 54, 54);
            }

            //!!!! default editor layout:

            // IsSystemWindow = true for this:
            // для этих "системных" окон используется отдельная логика сериализации (окна создаются до загрузки конфига)
            // и отдельная логика закрытия (hide/remove)
            workspaceController.AddToDockspaceStack(new DockWindow[] { new ObjectsWindow(), new SettingsWindow() }, DockingEdge.Right);
            //workspaceController.AddDockspace(new MembersWindow(), "Members", DockingEdge.Right, new Size(300, 300));
            workspaceController.AddToDockspaceStack(new DockWindow[] { new ResourcesWindow(), new SolutionExplorer(), new PreviewWindow() }, DockingEdge.Left);
            workspaceController.AddToDockspace(new DockWindow[] { new MessageLogWindow(), new OutputWindow(), new DebugInfoWindow() }, DockingEdge.Bottom);

            Log.Info("Use Log.Info(), Log.Warning() methods to write to the window. These methods can be used in the Player. Press '~' to open console of the Player.");
            OutputWindow.Print("Use OutputWindow.Print() method to write to the window. Unlike Message Log window, this window is not a list. Here you can add text in arbitrary format.\n");

            //!!!!эвент чтобы свои добавлять. и пример

            //load docking state
            {
                string configFile = VirtualPathUtility.GetRealPathByVirtual(dockingConfigFileName);
                //default settings
                if (!File.Exists(configFile))
                {
                    configFile = VirtualPathUtility.GetRealPathByVirtual(dockingConfigFileNameDefault);
                }

                if (File.Exists(configFile))
                {
                    //no try catch to save the ability to work with debugger. in case when error happens during loading one of documents

                    //try
                    //{
                    workspaceController.LoadLayoutFromFile(configFile);

                    //!!!!
                    //hack. unhide the page to load it correctly. after loading the page will hided
                    foreach (var page in workspaceController.DockingManager.Pages)
                    {
                        if (page.needHideAfterLoading)
                        {
                            page.needHideAfterLoading = false;

                            var window = page.GetDockWindow();
                            if (window != null)
                            {
                                workspaceController.SetDockWindowVisibility(window, false);
                            }
                        }
                    }

                    //}
                    //catch( Exception e2 )
                    //{
                    //	var text = $"Error loading docking settings.\n\n" + e2.Message;
                    //	Log.Warning( text );
                    //	EditorMessageBox.ShowWarning( text );
                    //}
                }
            }

            InitQAT();
            InitRibbon();

            UpdateText();

            //apply editor settings
            EditorSettingsSerialization.InitAfterFormLoad();

            XmlDocumentationFiles.PreloadBaseAssemblies();

            EditorAPI.SelectedDocumentWindowChanged += EditorAPI_SelectedDocumentWindowChanged;

            UpdateRecentProjectsInRegistry();

            LoginUtility.RequestFullLicenseInfo();

            kryptonRibbon.BeforeMinimizedModeChanged += KryptonRibbon_BeforeMinimizedModeChanged;
            kryptonRibbon.MinimizedModeChanged       += KryptonRibbon_MinimizedModeChanged;

            KryptonWinFormsUtility.editorFormStartTemporaryLockUpdateAction = delegate()
            {
                if (IsHandleCreated && !EditorAPI.ClosingApplication)
                {
                    KryptonWinFormsUtility.LockFormUpdate(this);
                    unlockFormUpdateInTimer = DateTime.Now + TimeSpan.FromSeconds(0.1);
                }
            };

            loaded = true;
        }