Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Logo"/> class.
        /// </summary>
        public Logo()
        {
            this.InitializeComponent();

            SettingsService settingsService = new SettingsService();

            this.labelVersion.Text += " " + settingsService.ApplicationVersion;

            this.labelMvvmCross.Text += " v" + settingsService.MvvmCrossVersion;

            this.labelBuildDateTime.Text = settingsService.BuildDateTime;
        }
        public void TestTranslator()
        {
            PluginsTranslator translator = new PluginsTranslator(new PluginTranslator(new SettingsService()));

            SettingsService settingsService = new SettingsService();

            DirectoryInfoBase directoryInfo1 = new DirectoryInfo(settingsService.MvvmCrossAssembliesPath);
            DirectoryInfoBase directoryInfo2 = new DirectoryInfo(settingsService.MvvmCrossAssembliesOverrideDirectory);

            Tuple<DirectoryInfoBase, DirectoryInfoBase> directories = new Tuple<DirectoryInfoBase, DirectoryInfoBase>(directoryInfo1, directoryInfo2);

            Plugins plugins = translator.Translate(directories);

            Assert.IsTrue(plugins.Items.Count > 0);
        }
Пример #3
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        private static void CheckForUpdate()
        {
            TraceService.WriteLine("NinjaCoder.MvvmCross.UpdateChecker::CheckForUpdate");

            try
            {
                VsIdeServiceClient client = new VsIdeServiceClient();

                SettingsService settingsService = new SettingsService();

                string[] keys = new string[1];
                keys[0] = settingsService.GalleryId;

                Dictionary<string, string> requestContext = new Dictionary<string, string>()
                                                            {
                                                                { "LCID", "1033" },
                                                                {"SearchSource", "ExtensionManagerUpdate"},
                                                            };

                string[] output = client.GetCurrentVersionsForVsixList(keys, requestContext);

                if (output.Length > 0)
                {
                    string version = output[0];

                    TraceService.WriteLine("NinjaCoder.MvvmCross.UpdateChecker::CheckForUpdate version=" + version);

                    settingsService.LatestVersionOnGallery = version;
                    settingsService.LastCheckedForUpdateDateTime = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                }
            }
            catch (Exception exception)
            {
                TraceService.WriteError("NinjaCoder.MvvmCross.UpdateChecker::CheckForUpdate Error=" + exception.Message);
            }
        }
        public void TestGetPluginTestSnippet()
        {
            Plugin plugin = new Plugin();

            MockFile mockFile = new MockFile { FileExists = true };
            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.PluginsCodeSnippetsPath).Returns(settingsService.PluginsCodeSnippetsPath);
            this.mockSettingsService.SetupGet(x => x.UserCodeSnippetsPluginsPath).Returns(settingsService.UserCodeSnippetsPluginsPath);

            this.mockTranslator.Setup(x => x.Translate(It.IsAny<string>())).Returns(new CodeSnippet());

            this.factory.GetPluginTestSnippet(plugin);

            this.mockTranslator.Verify(x => x.Translate(It.IsAny<string>()));
        }
Пример #5
0
        /// <summary>
        /// Runs custom wizard logic at the beginning of a template wizard run.
        /// </summary>
        /// <param name="automationObject">The automation object being used by the template wizard.</param>
        /// <param name="replacementsDictionary">The list of standard parameters to be replaced.</param>
        /// <param name="runKind">A <see cref="T:Microsoft.VisualStudio.TemplateWizard.WizardRunKind" /> indicating the type of wizard run.</param>
        /// <param name="customParams">The custom parameters with which to perform parameter replacement in the project.</param>
        public void RunStarted(
            object automationObject, 
            Dictionary<string, string> replacementsDictionary, 
            WizardRunKind runKind, 
            object[] customParams)
        {
            ////TraceService.WriteLine("BaseWizard::RunStarted");

            this.SettingsService = new SettingsService();

            TraceService.Initialize(
                this.SettingsService.LogToTrace,
                false,
                this.SettingsService.LogToFile,
                this.SettingsService.LogFilePath,
                this.SettingsService.DisplayErrors);

            this.Dte = automationObject as DTE;
            this.ReplacementsDictionary = replacementsDictionary;

            this.OnRunStarted();
        }
Пример #6
0
        /// <summary>
        /// Adds the commands.
        /// </summary>
        internal void AddCommands()
        {
            TraceService.WriteLine("Connect::AddCommands");

            CommandBar commandBar = this.AddCommandBar("Ninja Coder for MvvmCross");

            VSCommandInfo commandInfo = new VSCommandInfo
            {
                AddIn = this.AddInInstance,
                Name = "NinjaCoderforMvvmCrossAddProjects",
                ButtonText = "Add Projects",
                Tooltip = "Ninja Coder for MvvmCross Add Projects",
                Action = this.BuildProjects,
                ParentCommand = commandBar,
                BitmapResourceId = 0,
            };

            this.AddMenuItem(commandInfo);

            commandInfo = new VSCommandInfo
            {
                AddIn = this.AddInInstance,
                Name = "NinjaCoderforMvvmCrossAddViewModel",
                ButtonText = "Add ViewModel and Views",
                Tooltip = "Ninja Coder for MvvmCross Add ViewModel and Views",
                Action = this.AddViewModelAndViews,
                ParentCommand = commandBar,
                BitmapResourceId = 0,
            };

            this.AddMenuItem(commandInfo);

            commandInfo = new VSCommandInfo
            {
                AddIn = this.AddInInstance,
                Name = "NinjaCoderforMvvmCrossAddPlugins",
                ButtonText = "Add Plugins",
                Tooltip = "Ninja Coder for MvvmCross Add Plugins",
                Action = this.AddPlugins,
                ParentCommand = commandBar,
                BitmapResourceId = 0,
            };

            this.AddMenuItem(commandInfo);

            /*commandInfo = new VSCommandInfo
            {
                AddIn = this.AddInInstance,
                Name = "NinjaCoderforMvvmCrossAddServices",
                ButtonText = "Add Services",
                Tooltip = "Ninja Coder for MvvmCross Add Services",
                Action = this.AddServices,
                ParentCommand = commandBar,
                BitmapResourceId = 0,
            };

            this.AddMenuItem(commandInfo);*/

            commandInfo = new VSCommandInfo
            {
                AddIn = this.AddInInstance,
                Name = "NinjaCoderforMvvmCrossAddConverters",
                ButtonText = "Add Converters",
                Tooltip = "Ninja Coder for MvvmCross Add Converters",
                Action = this.AddConverters,
                ParentCommand = commandBar,
                BitmapResourceId = 0,
            };

            this.AddMenuItem(commandInfo);

            commandInfo = new VSCommandInfo
            {
                AddIn = this.AddInInstance,
                Name = "NinjaCoderforMvvmCrossOptions",
                ButtonText = "Options",
                Tooltip = "Ninja Coder for MvvmCross Options",
                Action = this.ShowOptions,
                ParentCommand = commandBar,
                BitmapResourceId = 0
            };

            this.AddMenuItem(commandInfo);

            SettingsService settingsService = new SettingsService();

            if (settingsService.ShowViewLogFileOnVisualStudioMenu)
            {
                commandInfo = new VSCommandInfo
                {
                    AddIn = this.AddInInstance,
                    Name = "NinjaCoderforMvvmCrossViewLogFile",
                    ButtonText = "View Log File",
                    Tooltip = "Ninja Coder for MvvmCross View Log File",
                    Action = this.ViewLogFile,
                    ParentCommand = commandBar,
                    BitmapResourceId = 0
                };

                this.AddMenuItem(commandInfo);
            }

            if (settingsService.ShowClearLogFileOnVisualStudioMenu)
            {
                commandInfo = new VSCommandInfo
                {
                    AddIn = this.AddInInstance,
                    Name = "NinjaCoderforMvvmCrossClearLogFile",
                    ButtonText = "Clear Log File",
                    Tooltip = "Ninja Coder for MvvmCross Clear Log File",
                    Action = this.ClearLogFile,
                    ParentCommand = commandBar,
                    BitmapResourceId = 0
                };

                this.AddMenuItem(commandInfo);
            }

            commandInfo = new VSCommandInfo
            {
                AddIn = this.AddInInstance,
                Name = "NinjaCoderforMvvmCrossAbout",
                ButtonText = "About",
                Tooltip = "Ninja Coder for MvvmCross About",
                Action = this.ShowAbout,
                ParentCommand = commandBar,
                BitmapResourceId = 0
            };

            this.AddMenuItem(commandInfo);

            TraceService.WriteLine("Connect::AddCommands Ended");
        }
        public void TestGetServiceConfig()
        {
            MockFile mockFile = new MockFile();
            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.ServicesConfigPath).Returns(settingsService.ServicesConfigPath);
            this.mockSettingsService.SetupGet(x => x.UserCodeConfigServicesPath).Returns(settingsService.UserCodeConfigServicesPath);

            this.mockTranslator.Setup(x => x.Translate(It.IsAny<string>())).Returns(new CodeConfig());

            this.factory.GetServiceConfig("friendlyName");

            this.mockTranslator.Verify(x => x.Translate(It.IsAny<string>()));
        }
        public void TestGetPluginConfig()
        {
            Plugin plugin = new Plugin { FriendlyName = "File" };

            MockFile mockFile = new MockFile();
            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.PluginsConfigPath).Returns(settingsService.PluginsConfigPath);
            this.mockSettingsService.SetupGet(x => x.UserCodeConfigPluginsPath).Returns(settingsService.UserCodeConfigPluginsPath);

            this.mockTranslator.Setup(x => x.Translate(It.IsAny<string>())).Returns(new CodeConfig());

            this.factory.GetPluginConfig(plugin);

            this.mockTranslator.Verify(x => x.Translate(It.IsAny<string>()));
        }