예제 #1
0
        private void ButtDelete_Click(object sender, System.EventArgs e)
        {
            DataGridViewRow row = gridSorts.SelectedRows.Cast <DataGridViewRow>().FirstOrDefault();

            if (row == null || MessageBox.Show(Manager["Question.Question"], Manager["Question"], MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)
            {
                return;
            }
            IUserSort sort = (IUserSort)row.Cells[1].Value;

            Delete(sort, row);
            string file = VSPackage.Loader.SortFiles.FirstOrDefault(x => x.Value == sort).Key;

            AssemblyLoader.Unload(file);
            if (File.Exists(file))
            {
                File.Delete(file);
            }
            RefreshData();
        }
예제 #2
0
        private void ButtUse_Click(object sender, System.EventArgs e)
        {
            DataGridViewRow row = gridSorts.SelectedRows.Cast <DataGridViewRow>().FirstOrDefault();

            if (row == null)
            {
                return;
            }
            IUserSort sort = (IUserSort)row.Cells[1].Value;

            if (Selected.Contains(sort.Guid))
            {
                Delete(sort, row);
            }
            else
            {
                Add(sort, row);
            }
            VSPackage.Loader.Settings.Loaded = Selected.ToArray();
            VSPackage.Loader.Settings.Save(SortsLoader.SettingsPath);
            gridSorts.ClearSelection();
        }
예제 #3
0
        public FormTestFunc(IUserSort Sorter) : this()
        {
            textTest.Text =
                @"using System.Threading.Tasks;
using System.IO;
using System.Collections.Generic;
using Antlr4.Runtime;
using System.Data;
using Microsoft.CodeAnalysis;
using System.Reflection;
using System;
using System.Text;
using System.Drawing;
using System.Numerics;
using System.Linq;
using System.Xml.Linq;
using System.Collections;
using Antlr4;
using Microsoft.CodeAnalysis.Text;
using Antlr4.Runtime.Misc;";
            this.Sorter = Sorter;
            Manager.Localize(this);
            Sort();
        }
예제 #4
0
 private void Delete(IUserSort Sort, DataGridViewRow Row)
 {
     Selected.Remove(Sort.Guid);
     Commands.CommandUserSort.Instance.Factory.Delete(x => x.GetParameter <string>("Guid"), Sort.Guid);
     SetBackColor(Row, NotSelectedSort);
 }
예제 #5
0
 private void Add(IUserSort Sort, DataGridViewRow Row)
 {
     Selected.Add(Sort.Guid);
     Commands.CommandUserSort.Instance.AddSort(Sort);
     SetBackColor(Row, SelectedSort);
 }
예제 #6
0
        public void AddSort(IUserSort Sort)
        {
            MenuCommandWrapper wrapper = Factory.Create(() => Sort.Sort(TextSelection.GetSelection(Package, Sort.EmptyLineAction, out int[] poses, out NewlineType newlineType, out bool was)).ReplaceSelection(Sort.EmptyLineAction, poses, newlineType, was), Sort.Name);

            wrapper.SetParameter("Guid", Sort.Guid);
        }