Пример #1
0
 private void Versongrid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == Versongrid.Columns["Getfileversions"].Index)
     {
         GitVersionControlpull pullobj = new GitVersionControlpull(@Globals.ThisAddIn.Application.ActiveWorkbook.FullName);
         string sha      = Convert.ToString(Versongrid[3, e.RowIndex].Value);
         string filepath = pullobj.GetFile(sha);
         string newfile  = Path.GetDirectoryName(filepath) + @"\" + Path.GetFileNameWithoutExtension(filepath) + DateTime.Now.ToString("ddMMyyyyHHmmss") + Path.GetExtension(filepath);
         File.Copy(filepath, newfile);
         Process.Start(newfile);
     }
 }
Пример #2
0
        public Fileversions()
        {
            GitVersionControlpull pullobj = new GitVersionControlpull(@Globals.ThisAddIn.Application.ActiveWorkbook.FullName);
            List <GitlogModel>    model   = pullobj.GetGitlog();

            InitializeComponent();
            Versongrid.DataSource = model;
            Versongrid.CellClick += Versongrid_CellClick;
            DataGridViewButtonColumn getversioncolumn = new DataGridViewButtonColumn();

            getversioncolumn.Name       = "Getfileversions";
            getversioncolumn.HeaderText = "Click to get file versions";
            getversioncolumn.Text       = "Get This Version";
            getversioncolumn.DefaultCellStyle.BackColor  = Color.White;
            getversioncolumn.UseColumnTextForButtonValue = true;
            int columnIndex = 3;

            if (Versongrid.Columns["Getfileversions"] == null)
            {
                Versongrid.Columns.Insert(columnIndex, getversioncolumn);
            }
        }