コード例 #1
0
ファイル: Plugin.cs プロジェクト: Yoooi0/BusDriver
        protected void Update()
        {
            if (SuperController.singleton.isLoading)
            {
                ComponentCache.Clear();
            }

            if (!_initialized || SuperController.singleton.isLoading)
            {
                return;
            }

            var sb = new StringBuilder();

            sb.Append("Up:      ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.L0) ?? float.NaN).AppendLine()
            .Append("Right:   ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.L1) ?? float.NaN).AppendLine()
            .Append("Forward: ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.L2) ?? float.NaN).AppendLine()
            .Append("Yaw:     ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.R0) ?? float.NaN).AppendLine()
            .Append("Pitch:   ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.R1) ?? float.NaN).AppendLine()
            .Append("Roll:    ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.R2) ?? float.NaN).AppendLine();

            ValuesSourceReportText.val = sb.ToString();

            DebugDraw.Draw();
            DebugDraw.Enabled = DebugDrawEnableToggle.val;
            _physicsIteration = 0;
        }
コード例 #2
0
ファイル: Plugin.cs プロジェクト: Yoooi0/ToySerialController
        protected void Update()
        {
            if (SuperController.singleton.isLoading)
            {
                ComponentCache.Clear();
            }

            if (!_initialized || SuperController.singleton.isLoading)
            {
                return;
            }

            DebugDraw.Draw();
            DebugDraw.Enabled = DebugDrawEnableToggle.val;
            _physicsIteration = 0;
        }
コード例 #3
0
        public virtual void CreateUI(IUIBuilder builder)
        {
            RefreshButton = builder.CreateButton("Refresh", () =>
            {
                ComponentCache.Clear();
                RefreshButtonCallback();
            });
            RefreshButton.buttonColor = new Color(0, 0.75f, 1f) * 0.8f;
            RefreshButton.textColor   = Color.white;

            Spacer = builder.CreateSpacer(200);

            RefreshAction = UIManager.CreateAction("Refresh Motion Source", () =>
            {
                ComponentCache.Clear();
                RefreshButtonCallback();
            });
        }
コード例 #4
0
 /// <summary>
 /// This is used to clear the component cache whenever a solution is closed
 /// </summary>
 private void solutionEvents_AfterClosing()
 {
     ComponentCache.Clear();
 }
コード例 #5
0
        /// <summary>
        /// This is overridden to initialize the package
        /// </summary>
        /// <remarks>This method is called right after the package is sited, so this is the place where you can
        /// put all the initialization code that relies on services provided by Visual Studio.</remarks>
        protected override async System.Threading.Tasks.Task InitializeAsync(
            System.Threading.CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of {0}",
                                          this.ToString()));

            await base.InitializeAsync(cancellationToken, progress);

            // When initialized asynchronously, we may be on a background thread at this point.  Do any
            // initialization that requires the UI thread after switching to the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            SandcastleBuilderPackage.Instance = this;

            // Add our command handlers for menu items (commands must exist in the .vsct file)
            if (await this.GetServiceAsync(typeof(IMenuCommandService)) is OleMenuCommandService mcs)
            {
                CommandID      commandId;
                OleMenuCommand menuItem;

                // Create the command for button ViewHelpFile
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHelpFile);
                menuItem  = new OleMenuCommand(ViewHelpFileExecuteHandler, null, ViewHelpFileQueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button ViewHtmlHelp
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewHtmlHelp);
                menuItem  = new OleMenuCommand(ViewHtmlHelpExecuteHandler, null, ViewHtmlHelpQueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button ViewMshcHelp
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewMshcHelp);
                menuItem  = new OleMenuCommand(ViewMshcHelpExecuteHandler, null, ViewMshcHelpQueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button ViewAspNetWebsite
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewAspNetWebsite);
                menuItem  = new OleMenuCommand(ViewAspNetWebsiteExecuteHandler, null, ViewAspNetWebsiteQueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button ViewFaq
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewFaq);
                menuItem  = new OleMenuCommand(ViewFaqExecuteHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button ViewShfbHelp
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewShfbHelp);
                menuItem  = new OleMenuCommand(ViewShfbHelpExecuteHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button OpenInStandaloneGUI
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.OpenInStandaloneGUI);
                menuItem  = new OleMenuCommand(OpenInStandaloneGUIExecuteHandler, null, OpenInStandaloneGUIQueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button ViewBuildLog
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewBuildLog);
                menuItem  = new OleMenuCommand(ViewBuildLogExecuteHandler, null, ViewBuildLogQueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button EntityReferencesWindow
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.EntityReferencesWindow);
                menuItem  = new OleMenuCommand(EntityReferencesWindowExecuteHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button TopicPreviewerWindow
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.TopicPreviewerWindow);
                menuItem  = new OleMenuCommand(TopicPreviewerWindowExecuteHandler, commandId);
                mcs.AddCommand(menuItem);

                // Create the command for button ViewDocxHelp
                commandId = new CommandID(GuidList.guidSandcastleBuilderPackageCmdSet, (int)PkgCmdIDList.ViewDocxHelp);
                menuItem  = new OleMenuCommand(ViewDocxHelpExecuteHandler, null, ViewDocxHelpQueryStatusHandler, commandId);
                mcs.AddCommand(menuItem);
            }

            // Register the project factory
            this.RegisterProjectFactory(new SandcastleBuilderProjectFactory(this));

            // Register the SHFB file editor factories
            base.RegisterEditorFactory(new ContentLayoutEditorFactory());
            base.RegisterEditorFactory(new ResourceItemEditorFactory());
            base.RegisterEditorFactory(new SiteMapEditorFactory());
            base.RegisterEditorFactory(new TokenEditorFactory());

            // Create the update solution event listener for build completed events
            buildCompletedListener = new BuildCompletedEventListener(this);

            // Register for solution events so that we can clear the component cache when necessary
            Microsoft.VisualStudio.Shell.Events.SolutionEvents.OnAfterCloseSolution += (s, e) => ComponentCache.Clear();

            try
            {
                // Set the owning window for WPF modal dialogs to the main Visual Studio window
                Sandcastle.Platform.Windows.WpfHelpers.MainWindowHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
            }
            catch
            {
                // Ignore exceptions.  There is no main window when invoked for a command line build.
                // It may also try to load the package before the main window is available if tool windows
                // were left open.  Worst case, modal dialogs may not appear over the main form on dual
                // monitor systems.
            }
        }