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(); }
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(); }
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(); }
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); }
private void Add(IUserSort Sort, DataGridViewRow Row) { Selected.Add(Sort.Guid); Commands.CommandUserSort.Instance.AddSort(Sort); SetBackColor(Row, SelectedSort); }
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); }