private void ExecShortCut(ShortcutData sc) { var dirPath = Environment.ExpandEnvironmentVariables(sc.AppPath); if (sc.AppName != "") { string StartFileName = ""; StartFileName = FormCommonMethod.GetLatestVersionName(dirPath, sc.AppName); string path = Path.Combine(dirPath, StartFileName); if (File.Exists(path)) { System.Diagnostics.Process.Start(path); } } else { if (Directory.Exists(dirPath)) { System.Diagnostics.Process.Start(dirPath); } } }
//メモリデータをDGVにセット private void setShortcutsListDGV() { ShortcutsListDGV.Rows.Clear(); //ShortcutsGridData.ForEach(sc => UnregisterHotKey(this.Handle, sc.AppKeyID)); //ShortcutsGridData.Clear(); //Properties.Settings.Default.ShortcutsString.Split("\r\n"). foreach (var ShortcutData in ShortcutsGridData) { DataGridViewRow dgvRow = new DataGridViewRow(); dgvRow.CreateCells(this.ShortcutsListDGV); dgvRow.Cells[0].Value = ShortcutData.AppPath; dgvRow.Cells[1].Value = ShortcutData.AppName; dgvRow.Cells[2].Value = ShortcutData.AppKey; var dirPath = Environment.ExpandEnvironmentVariables(ShortcutData.AppPath); if (ShortcutData.AppName != "") { dgvRow.Cells[3].Value = FormCommonMethod.GetLatestVersionName(dirPath, ShortcutData.AppName); if (dgvRow.Cells[3].Value.ToString() == string.Empty) { dgvRow.Cells[3].Value = "★なぞのえらーだよ"; } if (dgvRow.Cells[3].Value.ToString().IndexOf("★") > -1) { dgvRow.Cells[3].Style.BackColor = Color.FromArgb(244, 44, 44); } else { dgvRow.Cells[3].Style.BackColor = Color.FromArgb(192, 255, 192); } } else { dgvRow.Cells[3].Value = ShortcutData.AppPath.Substring(ShortcutData.AppPath.LastIndexOf(@"\") + 1) + "フォルダ"; dgvRow.Cells[3].Style.BackColor = Color.FromArgb(192, 255, 192); } ShortcutsListDGV.Rows.Add(dgvRow); } }