Esempio n. 1
0
 public NewItemModel(IPlcncliCommunication plcncliCommunication, string projectDirectory, string itemType)
 {
     _plcncliCommunication = plcncliCommunication;
     _projectDirectory     = projectDirectory;
     ItemType = itemType;
     FetchProjectComponents();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ImportProjectCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        /// <param name="commandService">Command service to add command to, not null.</param>
        private ImportProjectCommand(AsyncPackage package, OleMenuCommandService commandService)
        {
            this.package = package ?? throw new ArgumentNullException(nameof(package));

            commandService        = commandService ?? throw new ArgumentNullException(nameof(commandService));
            _plcncliCommunication = Package.GetGlobalService(typeof(SPlcncliCommunication)) as IPlcncliCommunication;

            var menuCommandID = new CommandID(CommandSet, CommandId);
            var menuItem      = new OleMenuCommand(this.Import, menuCommandID);

            commandService.AddCommand(menuItem);
        }
Esempio n. 3
0
 public SdkPage()
 {
     try
     {
         plcncliCommunication = Package.GetGlobalService(typeof(SPlcncliCommunication)) as IPlcncliCommunication;
         model       = new SDKPageModel(plcncliCommunication);
         viewModel   = new SDKPageViewModel(model);
         PageControl = new SDKPageControl(viewModel);
     }
     catch (Exception e)
     {
         ThreadHelper.ThrowIfNotOnUIThread();
         IVsActivityLog log = Package.GetGlobalService(typeof(SVsActivityLog)) as IVsActivityLog;
         log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, this.ToString(),
                      "An error occurred while creating the sdk page: " + e.Message);
     }
 }
        public ProjectTargetValueEditorModel(IServiceProvider serviceProvider, string projectDirectory)
        {
            this.serviceProvider = serviceProvider;
            IPlcncliCommunication cliCommunication = serviceProvider.GetService(typeof(SPlcncliCommunication)) as IPlcncliCommunication;

            if (cliCommunication != null)
            {
                TargetsCommandResult targetsCommandResult =
                    cliCommunication.ExecuteCommand(Resources.Command_get_targets, null, typeof(TargetsCommandResult))
                    as TargetsCommandResult;
                InstalledTargets = targetsCommandResult.Targets;

                ProjectInformationCommandResult projectInfo = cliCommunication.ExecuteCommand(
                    Resources.Command_get_project_information, null, typeof(ProjectInformationCommandResult),
                    Resources.Option_get_project_information_no_include_detection,
                    Resources.Option_get_project_information_project, $"\"{projectDirectory}\"") as
                                                              ProjectInformationCommandResult;
                ProjectTargets = projectInfo.Targets;
                //TODO extract these commands somewhere after the viewModel.Showmodal call (and possibly asyncron), otherwise the ui seems to be too unresponsive
            }
        }
Esempio n. 5
0
 public ProjectCreationWizard()
 {
     _plcncliCommunication = Package.GetGlobalService(typeof(SPlcncliCommunication)) as IPlcncliCommunication;
 }
Esempio n. 6
0
 public SaveCMakeListsEventHandler(AsyncPackage package, IVsRunningDocumentTable rdt)
 {
     runningDocumentTable = rdt;
     optionPage           = package.GetDialogPage(typeof(PlcncliOptionPage)) as PlcncliOptionPage;
     cliCommunication     = Package.GetGlobalService(typeof(SPlcncliCommunication)) as IPlcncliCommunication;
 }
Esempio n. 7
0
 public SDKPageModel(IPlcncliCommunication plcncliCommunication)
 {
     this.plcncli = plcncliCommunication;
     Initialize();
 }