Пример #1
0
        public async void OpenInVisualStudio(string filename, int line)
        {
            if (!File.Exists(filename))
            {
                if (TaskDialogHelper.ShowTaskDialog(
                        Handle,
                        "File Not Exists",
                        "File not found. Would you like to locate file by sourself?",
                        "Filename: " + filename,
                        TaskDialogStandardIcon.Error,
                        new string[] { "Browse", "Cancel" },
                        null,
                        new TaskDialogResult[] { TaskDialogResult.Yes, TaskDialogResult.No, }
                        ) != TaskDialogResult.Yes)
                {
                    return;
                }

                string file = PathUtils.GetFilename(filename);
                odSourceFile.Filter   = file + "|" + file;
                odSourceFile.FileName = file;
                if (odSourceFile.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                filename = odSourceFile.FileName;
            }
            string vs = Configs.Instance.GetRecentProperty(mapping.Mapping.Filename, Configs.PROPERTY_EDITOR);

            if (vs == null)
            {
                vs = Configs.Instance.Editor;
            }
            IVisualStudioInfo visualStudio = VisualStudioDetector.GetVisualStudioInfo(vs);

            BeginLoading("Starting the Visual Studio...");
            try
            {
                await Task.Run(() => visualStudio.OpenFile(filename, line));
            }
            catch (Exception ex)
            {
                this.SetTaskbarProgressValue(100, 100);
                this.SetTaskbarProgressState(Taskbar.ThumbnailProgressState.Error);
                TaskDialogHelper.ShowMessageBox(
                    Handle,
                    "Failed to Open in Visual Studio",
                    "Failed to open in Visual Studio. Try to use another version of Visual Studio.",
                    filename + ":" + line + "\n" + ex.Message,
                    TaskDialogStandardIcon.Error
                    );
            }
            EndLoading("");
        }
Пример #2
0
        protected override void Load(NanoXmlElement doc)
        {
            NanoXmlElement recentsEl = doc.GetElement("Recents");

            foreach (NanoXmlElement childElement in recentsEl.ChildElements)
            {
                if (File.Exists(childElement.GetAttribute("filename")))
                {
                    recents.Add(new RecentItem(childElement));
                }
            }

            NanoXmlElement settingsEl = doc.GetElement("Settings");

            settingsEl.GetValueIfExists("ShowModules", ref showModules);
            settingsEl.GetValueIfExists("ShowSkipped", ref showSkipped);
            settingsEl.GetValueIfExists("ShowResources", ref showResources);
            settingsEl.GetValueIfExists("GroupResources", ref groupResources);
            settingsEl.GetValueIfExists("GroupNamespaces", ref groupNamespaces);
            settingsEl.GetValueIfExists("GroupModules", ref groupModules);
            settingsEl.GetValueIfExists("UseColumns", ref useColumns);
            settingsEl.GetValueIfExists("ShowOriginal", ref showOriginal);
            settingsEl.GetValueIfExists("ShowUnicode", ref showUnicode);
            settingsEl.GetValueIfExists("SimplifySystem", ref simplifySystemNames);
            settingsEl.GetValueIfExists("SimplifyNullable", ref simplifyNullable);
            settingsEl.GetValueIfExists("SimplifyRef", ref simplifyRef);
            settingsEl.GetValueIfExists("SortingType", ref sortingType);
            settingsEl.GetValueIfExists("Editor", ref editor);
            settingsEl.GetValueIfExists("DoubleClickAction", ref doubleClickAction);
            settingsEl.GetValueIfExists("WatchClipboard", ref watchClipboard);

            if (editor == null)
            {
                editor = VisualStudioDetector.GetHighestVisualStudio().Description;
            }

            commandsElement = doc.GetElement("Actions");

            NanoXmlElement updateEl = doc.GetElement("Update");

            if (updateEl == null)
            {
                updateEl = doc.GetElement("update");
            }
            if (updateEl != null)
            {
                updateHelper.Load(updateEl);
            }
        }
Пример #3
0
 protected override void LoadDefaults()
 {
     editor = VisualStudioDetector.GetHighestVisualStudio().Description;
 }
Пример #4
0
        public SettingsForm(Mapping mapping, ICommandManager commandManager)
        {
            this.mapping = mapping;
            InitializeComponent();

            string vs = null;

            if (mapping != null)
            {
                vs = Configs.Instance.GetRecentProperty(mapping.Filename, Configs.PROPERTY_EDITOR);
            }
            else
            {
                cbApplyVsToProject.Checked = cbApplyVsToProject.Enabled = false;
            }

            if (vs == null)
            {
                vs = Configs.Instance.Editor;
            }
            IVisualStudioInfo selected = VisualStudioDetector.GetVisualStudioInfo(vs);

            if (selected == null)
            {
                selected = VisualStudioDetector.GetHighestVisualStudio();
            }

            foreach (IVisualStudioInfo info in VisualStudioDetector.GetVisualStudios())
            {
                BrokenListItem item = new BrokenListItem(info.Description);
                try
                {
                    Icon icon = Icon.ExtractAssociatedIcon(info.Path);
                    imageList.Images.Add(icon);
                    item.ImageIndex = imageList.Images.Count - 1;
                }
                catch { }
                item.Tag = info;

                blvEditors.Items.Add(item);

                if (info == selected)
                {
                    item.Selected = true;
                }
            }

            cbShowUnicode.Checked         = Configs.Instance.ShowUnicode;
            cbSimplifySystemNames.Checked = Configs.Instance.SimplifySystemNames;
            cbSimplifyNullable.Checked    = Configs.Instance.SimplifyNullable;
            cbSimplifyRef.Checked         = Configs.Instance.SimplifyRef;
            cbGroupByNamespaces.Checked   = Configs.Instance.GroupNamespaces;
            cbGroupByModules.Checked      = Configs.Instance.GroupModules;
            cbUseColumns.Checked          = Configs.Instance.UseColumns;
            cbWatchClipboard.Checked      = Configs.Instance.WatchClipboard;

            EnumHelper.FillCombobox(cbDoubleClick, Configs.Instance.DoubleClickAction);
            EnumHelper.FillCombobox(cbUpdateInterval, Configs.Instance.UpdateHelper.Interval);

            commandSelector.CommandManager = commandManager;
            commandSelector.CommandType    = typeof(Actions);
        }