Example #1
0
        public static void Initialize(IBuilder builder)
        {
            appThread = new Thread(() =>
            {
                Application = new Application();
                Application.DispatcherUnhandledException += Application_DispatcherUnhandledException;
                Application.ShutdownMode = ShutdownMode.OnExplicitShutdown;
                Application.Run(new MainWindow());
            });
            appThread.SetApartmentState(ApartmentState.STA);

            // set the UI Context to get components we need for the UI
            UIContext = new UIContext(builder);
        }
Example #2
0
 public EditValueTextWidget(UIContext context) : base(context)
 {
     editableText = (EditableText)typeof(EditableTextWidget).GetField("_editableText", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this);
 }
Example #3
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            var services = (IServiceContainer)this;

            // register our options service which provides registry access for various options
            var optionsService = new PythonToolsOptionsService(this);

            services.AddService(typeof(IPythonToolsOptionsService), optionsService, promote: true);

            services.AddService(typeof(IClipboardService), new ClipboardService(), promote: true);

            services.AddService(typeof(IPythonToolsToolWindowService), this, promote: true);

            // register our PythonToolsService which provides access to core PTVS functionality
            var pyService = _pyService = new PythonToolsService(services);

            services.AddService(typeof(PythonToolsService), pyService, promote: true);

            _autoObject = new PythonAutomation(this);

            services.AddService(
                typeof(ErrorTaskProvider),
                (container, serviceType) => {
                var errorList     = GetService(typeof(SVsErrorList)) as IVsTaskList;
                var model         = ComponentModel;
                var errorProvider = model != null ? model.GetService <IErrorProviderFactory>() : null;
                return(new ErrorTaskProvider(this, errorList, errorProvider));
            },
                promote: true);

            services.AddService(
                typeof(CommentTaskProvider),
                (container, serviceType) => {
                var taskList      = GetService(typeof(SVsTaskList)) as IVsTaskList;
                var model         = ComponentModel;
                var errorProvider = model != null ? model.GetService <IErrorProviderFactory>() : null;
                return(new CommentTaskProvider(this, taskList, errorProvider));
            },
                promote: true);

            var solutionEventListener = new SolutionEventsListener(this);

            solutionEventListener.StartListeningForChanges();

            services.AddService(
                typeof(SolutionEventsListener),
                solutionEventListener,
                promote: true
                );

            // Register custom debug event service
            var customDebuggerEventHandler = new CustomDebuggerEventHandler(this);

            services.AddService(customDebuggerEventHandler.GetType(), customDebuggerEventHandler, promote: true);

            // Enable the mixed-mode debugger UI context
            UIContext.FromUIContextGuid(DkmEngineId.NativeEng).IsActive = true;

            // Add our command handlers for menu (commands must exist in the .vsct file)
            RegisterCommands(new Command[] {
                new OpenDebugReplCommand(this),
                new ExecuteInReplCommand(this),
                new SendToReplCommand(this),
                new StartWithoutDebuggingCommand(this),
                new StartDebuggingCommand(this),
                new FillParagraphCommand(this),
                new SendToDefiningModuleCommand(this),
                new DiagnosticsCommand(this),
                new RemoveImportsCommand(this),
                new RemoveImportsCurrentScopeCommand(this),
                new OpenInterpreterListCommand(this),
                new ImportWizardCommand(this),
                new SurveyNewsCommand(this),
                new ShowPythonViewCommand(this),
                new ShowCppViewCommand(this),
                new ShowNativePythonFrames(this),
                new UsePythonStepping(this),
            }, GuidList.guidPythonToolsCmdSet);

#if DEV14
            try {
                RegisterCommands(new Command[] {
                    new AzureExplorerAttachDebuggerCommand(this)
                }, GuidList.guidPythonToolsCmdSet);
            } catch (NotSupportedException) {
            }
#endif


            RegisterCommands(GetReplCommands(), GuidList.guidPythonToolsCmdSet);

            RegisterProjectFactory(new PythonWebProjectFactory(this));

            // Enable the Python debugger UI context
            UIContext.FromUIContextGuid(AD7Engine.DebugEngineGuid).IsActive = true;

            var interpreterService = ComponentModel.GetService <IInterpreterOptionsService>();
            interpreterService.InterpretersChanged       += RefreshReplCommands;
            interpreterService.DefaultInterpreterChanged += RefreshReplCommands;

            var loadedProjectProvider = interpreterService.KnownProviders
                                        .OfType <LoadedProjectInterpreterFactoryProvider>()
                                        .FirstOrDefault();
            // Ensure the provider is available - if not, you probably need to
            // rebuild or clean your experimental hive.
            Debug.Assert(loadedProjectProvider != null, "Expected LoadedProjectInterpreterFactoryProvider");
            if (loadedProjectProvider != null)
            {
                loadedProjectProvider.SetSolution((IVsSolution)GetService(typeof(SVsSolution)));
            }

            // The variable is inherited by child processes backing Test Explorer, and is used in PTVS
            // test discoverer and test executor to connect back to VS.
            Environment.SetEnvironmentVariable("_PTVS_PID", Process.GetCurrentProcess().Id.ToString());
        }
Example #4
0
 public UIContext GetUIContext()
 => UIContext.FromUIContextGuid(Guids.CSharpProjectExistsInWorkspaceUIContext);
Example #5
0
        private void NotificationSideBarView_Loaded(object sender, RoutedEventArgs e)
        {
            UIContext dataContext = new UIContext();

            dataContext.setWindowContext(this);
        }
Example #6
0
        public void onActionTriggered(object source, string ID, string TriggeredText, UIContext u)
        {
            if (TriggeredText != "")
            {
                MessageBox.Show("Got triggered text in input array");
            }

            sendTrigger(ID, -1);
            //this.EventTriggered(source, ID, TriggeredText,this);
        }
Example #7
0
        private void RefreshData()
        {
            UIContext context = new UIContext();
            PasswordGrid.BreadcrumbRoot = context.GetBreadcrumbRoot();

            TemplateGrid.BreadcrumbRoot =
            PasswordGrid.RootCategory = context.GetCategoryRoot();

            foreach (string res in new string[] {
                "fieldTypesData"
                ,"categoryData"
                ,"folderData"
            })
            {
                ObjectDataProvider provider = Resources[res] as ObjectDataProvider;
                if (provider != null)
                {
                    provider.InitialLoad();
                    provider.Refresh();
                }
            }
        }
 public ModLibSliderWidget(UIContext context) : base(context)
 {
 }
Example #9
0
 public IVSUIContext GetUIContext(Guid contextGuid)
 {
     return(new VSUIContext(UIContext.FromUIContextGuid(contextGuid)));
 }
Example #10
0
 public VSUIContext(UIContext context)
 {
     this.context = context;
 }
 public void onActionTriggered(object source, string ID, string TriggeredText, UIContext u)
 {
     if (TriggeredText == "")
     {
         TriggeredText = "<TRIGGERED ID=\"" + ID + "\"></TRIGGERED>";
     }
     this.EventTriggered(source, ID, TriggeredText, this);
 }
        /// <summary>
        /// Checks if the VS instance is running as a Live Share guest session.
        /// </summary>
        private static bool IsLiveShareGuest()
        {
            var context = UIContext.FromUIContextGuid(LiveShareGuestUIContextGuid);

            return(context.IsActive);
        }
        public bool IsCloudEnvironmentClient()
        {
            var context = UIContext.FromUIContextGuid(VSConstants.UICONTEXT.CloudEnvironmentConnected_guid);

            return(context.IsActive);
        }
Example #14
0
 public BattleMiniMap_MapWidget(UIContext context) : base(context)
 {
     TextureProviderName = nameof(BattleMiniMap_MiniMapTextureProvider);
     WidthSizePolicy     = HeightSizePolicy = SizePolicy.Fixed;
 }
        // Private protected virtual for testing
        private protected virtual bool IsLiveShareHost()
        {
            var context = UIContext.FromUIContextGuid(LiveShareHostUIContextGuid);

            return(context.IsActive);
        }
Example #16
0
        public void ActionFieldTriggered(object source, string ID, string TriggeredText, UIContext u)
        {
            foreach (FGLFoundField f in activeFields)
            {
                if (f.fglField == source)
                {
                    CurrentField = f;
                    break;
                }
            }

            if (ID != "")
            {
                sendTrigger(ID);
            }
        }
        // Private protected virtual for testing
        private protected virtual bool IsVSRemoteClient()
        {
            var context = UIContext.FromUIContextGuid(VSConstants.UICONTEXT.CloudEnvironmentConnected_guid);

            return(context.IsActive);
        }
Example #18
0
 public void AddContext(Guid contextGuid, string contextName)
 {
     AddContext(UIContext.FromUIContextGuid(contextGuid), contextName);
 }
Example #19
0
 public void Initialize()
 {
     UIContext.SetTestContext(new SynchronizationContextForTests());
 }
Example #20
0
 public void RemoveContext(Guid contextGuid)
 {
     RemoveContext(UIContext.FromUIContextGuid(contextGuid));
 }
Example #21
0
 protected virtual void OnBreadcrumbRootChanged(NodeBase oldNode, NodeBase newNode)
 {
     BreadcrumbHierarchy = UIContext.GetBreadcrumbDropDownData(newNode);
     CategoryHierarchy   = UIContext.GetBreadcrumbDropDownData(BizContext.Instance.Categories.FirstOrDefault());
 }
Example #22
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine("Entering Initialize() of: {0}".FormatUI(this));
            base.Initialize();

            var services = (IServiceContainer)this;

            // register our options service which provides registry access for various options
            services.AddService(typeof(IPythonToolsOptionsService), PythonToolsOptionsService.CreateService, promote: true);

            services.AddService(typeof(IClipboardService), new ClipboardService(), promote: true);

            services.AddService(typeof(IPythonToolsToolWindowService), this, promote: true);

            // register our PythonToolsService which provides access to core PTVS functionality
            PythonToolsService pyService;

            try {
                pyService = _pyService = new PythonToolsService(services);
            } catch (Exception ex) when(!ex.IsCriticalException())
            {
                ex.ReportUnhandledException(services, GetType(), allowUI: false);
                throw;
            }

            services.AddService(typeof(PythonToolsService), pyService, promote: true);

            _autoObject = new PythonAutomation(this);

            services.AddService(
                typeof(ErrorTaskProvider),
                (container, serviceType) => {
                var errorList     = GetService(typeof(SVsErrorList)) as IVsTaskList;
                var model         = ComponentModel;
                var errorProvider = model != null ? model.GetService <IErrorProviderFactory>() : null;
                return(new ErrorTaskProvider(this, errorList, errorProvider));
            },
                promote: true);

            services.AddService(
                typeof(CommentTaskProvider),
                (container, serviceType) => {
                var taskList      = GetService(typeof(SVsTaskList)) as IVsTaskList;
                var model         = ComponentModel;
                var errorProvider = model != null ? model.GetService <IErrorProviderFactory>() : null;
                return(new CommentTaskProvider(this, taskList, errorProvider));
            },
                promote: true);


            var solutionEventListener = new SolutionEventsListener(this);

            solutionEventListener.StartListeningForChanges();

            services.AddService(
                typeof(SolutionEventsListener),
                solutionEventListener,
                promote: true
                );

            // Register custom debug event service
            var customDebuggerEventHandler = new CustomDebuggerEventHandler(this);

            services.AddService(customDebuggerEventHandler.GetType(), customDebuggerEventHandler, promote: true);

            // Enable the mixed-mode debugger UI context
            UIContext.FromUIContextGuid(DkmEngineId.NativeEng).IsActive = true;

            // Add our command handlers for menu (commands must exist in the .vsct file)
            RegisterCommands(new Command[] {
                new OpenReplCommand(this, (int)PkgCmdIDList.cmdidReplWindow),
                new OpenReplCommand(this, (int)PythonConstants.OpenInteractiveForEnvironment),
                new OpenDebugReplCommand(this),
                new ExecuteInReplCommand(this),
                new SendToReplCommand(this),
                new StartWithoutDebuggingCommand(this),
                new StartDebuggingCommand(this),
                new FillParagraphCommand(this),
                new DiagnosticsCommand(this),
                new RemoveImportsCommand(this, true),
                new RemoveImportsCommand(this, false),
                new OpenInterpreterListCommand(this),
                new ImportWizardCommand(this),
                new SurveyNewsCommand(this),
                new ImportCoverageCommand(this),
                new ShowPythonViewCommand(this),
                new ShowCppViewCommand(this),
                new ShowNativePythonFrames(this),
                new UsePythonStepping(this),
                new AzureExplorerAttachDebuggerCommand(this),
            }, GuidList.guidPythonToolsCmdSet);


            // Enable the Python debugger UI context
            UIContext.FromUIContextGuid(AD7Engine.DebugEngineGuid).IsActive = true;

            var interpreters       = ComponentModel.GetService <IInterpreterRegistryService>();
            var interpreterService = ComponentModel.GetService <IInterpreterOptionsService>();

            // The variable is inherited by child processes backing Test Explorer, and is used in PTVS
            // test discoverer and test executor to connect back to VS.
            Environment.SetEnvironmentVariable("_PTVS_PID", Process.GetCurrentProcess().Id.ToString());

            Trace.WriteLine("Leaving Initialize() of: {0}".FormatUI(this));
        }
Example #23
0
 public KingdomDiplomacyPanelTabControlWidget(UIContext context) : base(context)
 {
 }
 public TitleMenuInitializer(UIContext context)
 {
     this.context = context;
 }
 public EditValueTextWidget_v3(UIContext context) : base(context)
 {
     _editableWidget = (EditableText)typeof(EditableTextWidget).GetField("_editableText", BindingFlags.Instance | BindingFlags.NonPublic)
                       .GetValue(this);
 }
Example #26
0
 public LockLeftPanelWidget(UIContext context) : base(context)
 {
     IsLeftPanelLocked = SettingsLoader.Instance.Settings.IsLeftPanelLocked;
     this.IsSelected   = IsLeftPanelLocked;
 }
 public void Refresh()
 {
     GitUIContext = GitUIContext ?? UIContext.FromUIContextGuid(new Guid(Guids.GitSccProviderId));
     UIContextChanged(GitUIContext?.IsActive ?? false, true);
 }
 public ClassicOptionsScreenWidget(UIContext context) : base(context)
 {
 }
Example #29
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine("Entering Initialize() of: {0}".FormatUI(this));
            base.Initialize();

            var services = (IServiceContainer)this;

            services.AddService(typeof(IPythonToolsOptionsService), PythonToolsOptionsService.CreateService, promote: true);
            services.AddService(typeof(IClipboardService), new ClipboardService(), promote: true);
            services.AddService(typeof(IPythonToolsToolWindowService), this, promote: true);
            services.AddService(typeof(PythonLanguageInfo), (container, serviceType) => new PythonLanguageInfo(container), true);
            services.AddService(typeof(PythonToolsService), PythonToolsService.CreateService, promote: true);
            services.AddService(typeof(ErrorTaskProvider), ErrorTaskProvider.CreateService, promote: true);
            services.AddService(typeof(CommentTaskProvider), CommentTaskProvider.CreateService, promote: true);

            var solutionEventListener = new SolutionEventsListener(this);

            solutionEventListener.StartListeningForChanges();

            services.AddService(typeof(SolutionEventsListener), solutionEventListener, promote: true);

            // Register custom debug event service
            var customDebuggerEventHandler = new CustomDebuggerEventHandler(this);

            services.AddService(customDebuggerEventHandler.GetType(), customDebuggerEventHandler, promote: true);

            // Enable the mixed-mode debugger UI context
            UIContext.FromUIContextGuid(DkmEngineId.NativeEng).IsActive = true;

            // Add our command handlers for menu (commands must exist in the .vsct file)
            RegisterCommands(new Command[] {
                new OpenReplCommand(this, (int)PkgCmdIDList.cmdidReplWindow),
                new OpenReplCommand(this, (int)PythonConstants.OpenInteractiveForEnvironment),
                new OpenDebugReplCommand(this),
                new ExecuteInReplCommand(this),
                new SendToReplCommand(this),
                new FillParagraphCommand(this),
                new RemoveImportsCommand(this, true),
                new RemoveImportsCommand(this, false),
                new OpenInterpreterListCommand(this),
                new ImportWizardCommand(this),
                new SurveyNewsCommand(this),
                new ImportCoverageCommand(this),
                new ShowPythonViewCommand(this),
                new ShowCppViewCommand(this),
                new ShowNativePythonFrames(this),
                new UsePythonStepping(this),
                new AzureExplorerAttachDebuggerCommand(this),
                new OpenWebUrlCommand(this, "https://go.microsoft.com/fwlink/?linkid=832525", PkgCmdIDList.cmdidWebPythonAtMicrosoft),
                new OpenWebUrlCommand(this, Strings.IssueTrackerUrl, PkgCmdIDList.cmdidWebPTVSSupport),
                new OpenWebUrlCommand(this, "https://go.microsoft.com/fwlink/?linkid=832517", PkgCmdIDList.cmdidWebDGProducts),
            }, GuidList.guidPythonToolsCmdSet);


            // Enable the Python debugger UI context
            UIContext.FromUIContextGuid(AD7Engine.DebugEngineGuid).IsActive = true;

            // The variable is inherited by child processes backing Test Explorer, and is used in PTVS
            // test discoverer and test executor to connect back to VS.
            Environment.SetEnvironmentVariable("_PTVS_PID", Process.GetCurrentProcess().Id.ToString());

            Trace.WriteLine("Leaving Initialize() of: {0}".FormatUI(this));
        }
Example #30
0
 public UIContext GetUIContext()
 {
     return(UIContext.FromUIContextGuid(Guids.CSharpProjectExistsInWorkspaceUIContext));
 }
Example #31
0
 public TimePanel(UIContext context)
     : base(context)
 {
     AddState("Disabled");
 }
Example #32
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation

        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            Trace.WriteLine("Entering InitializeAsync() of: {0}".FormatUI(this));

            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            await base.InitializeAsync(cancellationToken, progress);

            AddService <IClipboardService>(new ClipboardService(), true);
            AddService <IPythonToolsToolWindowService>(this, true);
            AddService <PythonLanguageInfo>((container, serviceType) => new PythonLanguageInfo(this), promote: true);
            AddService <CustomDebuggerEventHandler>((container, serviceType) => new CustomDebuggerEventHandler(this), promote: true);
            AddService <IPythonToolsOptionsService>(PythonToolsOptionsService.CreateService, promote: true);
            AddService <IPythonToolsLogger>(PythonToolsLogger.CreateService, promote: true);
            AddService <PythonToolsService>(PythonToolsService.CreateService, promote: true);
            AddService <ErrorTaskProvider>(ErrorTaskProvider.CreateService, promote: true);
            AddService <CommentTaskProvider>(CommentTaskProvider.CreateService, promote: true);
            AddService <IPythonDebugOptionsService>((container, serviceType) => new PythonDebugOptionsService(this), promote: true);

            var solutionEventListener = new SolutionEventsListener(this);

            solutionEventListener.StartListeningForChanges();
            AddService <SolutionEventsListener>(solutionEventListener, true);

            // Enable the mixed-mode debugger UI context
            UIContext.FromUIContextGuid(DkmEngineId.NativeEng).IsActive = true;

            // Add our command handlers for menu (commands must exist in the .vsct file)
            RegisterCommands(GuidList.guidPythonToolsCmdSet,
                             new OpenReplCommand(this, (int)PkgCmdIDList.cmdidReplWindow),
                             new OpenReplCommand(this, PythonConstants.OpenInteractiveForEnvironment),
                             new OpenDebugReplCommand(this),
                             new ExecuteInReplCommand(this),
                             new SendToReplCommand(this),
                             new FillParagraphCommand(this),
                             new DiagnosticsCommand(this),
                             new RemoveImportsCommand(this, true),
                             new RemoveImportsCommand(this, false),
                             new OpenInterpreterListCommand(this),
                             new ImportWizardCommand(this),
                             new ImportCoverageCommand(this),
                             new ShowPythonViewCommand(this),
                             new ShowCppViewCommand(this),
                             new ShowNativePythonFrames(this),
                             new UsePythonStepping(this),
                             new ViewAllEnvironmentsCommand(this),
                             new OpenWebUrlCommand(this, "https://go.microsoft.com/fwlink/?linkid=832525", PkgCmdIDList.cmdidWebPythonAtMicrosoft),
                             new OpenWebUrlCommand(this, Strings.IssueTrackerUrl, PkgCmdIDList.cmdidWebPTVSSupport),
                             new OpenWebUrlCommand(this, "https://go.microsoft.com/fwlink/?linkid=832517", PkgCmdIDList.cmdidWebDGProducts));

            RegisterCommands(
                CommandAsyncToOleMenuCommandShimFactory.CreateCommand(GuidList.guidPythonToolsCmdSet, (int)PkgCmdIDList.cmdidAddEnvironment, new AddEnvironmentCommand(this)),
                CommandAsyncToOleMenuCommandShimFactory.CreateCommand(GuidList.guidPythonToolsCmdSet, PythonConstants.InstallPythonPackage, new ManagePackagesCommand(this)),
                new CurrentEnvironmentCommand(this),
                new CurrentEnvironmentListCommand(this)
                );

            // Enable the Python debugger UI context
            UIContext.FromUIContextGuid(AD7Engine.DebugEngineGuid).IsActive = true;

            // The variable is inherited by child processes backing Test Explorer, and is used in PTVS
            // test discoverer and test executor to connect back to VS.
            Environment.SetEnvironmentVariable("_PTVS_PID", Process.GetCurrentProcess().Id.ToString());

            Trace.WriteLine("Leaving Initialize() of: {0}".FormatUI(this));
        }
 public WINTRUST_DATA(WINTRUST_FILE_INFO fileInfo)
 {
     cbStruct            = (uint)Marshal.SizeOf(typeof(WINTRUST_DATA));
     pInfoStruct         = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(WINTRUST_FILE_INFO)));
     Marshal.StructureToPtr(fileInfo, pInfoStruct, false);
     dwUnionChoice       = UnionChoice.File;
     pPolicyCallbackData = IntPtr.Zero;
     pSIPCallbackData    = IntPtr.Zero;
     dwUIChoice          = UiChoice.NoUI;
     fdwRevocationChecks = RevocationCheckFlags.None;
     dwStateAction       = StateAction.Ignore;
     hWVTStateData       = IntPtr.Zero;
     pwszURLReference    = IntPtr.Zero;
     dwProvFlags         = TrustProviderFlags.Safer;
     dwUIContext         = UIContext.Execute;
 }
 protected virtual void OnSearchTextChanged(string oldValue, string newValue)
 {
     SelectedNode = new UIContext().RootCategory;
     bool hasText = !string.IsNullOrEmpty(newValue);
     delBtn.Visibility = hasText ? Visibility.Visible : Visibility.Collapsed;
     fndBtn.Visibility = !hasText ? Visibility.Visible : Visibility.Collapsed;
     UpdatePasswords(SelectedNode);
 }