private void SettionTab1() { string toolsPath = Application.StartupPath + @"\Softwares\ElijahSofts\"; if (Directory.Exists(toolsPath) == true) { DirectoryInfo dInfo = new DirectoryInfo(toolsPath); DirectoryInfo[] dInfos = dInfo.GetDirectories(); int buttonCount = dInfos.Count(); for (int i = 0; i < buttonCount; i++) { FileInfo[] fInfos = dInfos[i].GetFiles("SoftConfig.xml"); if (fInfos.Count() > 0) { try { string[] values = GetSoftInfo(fInfos[0].FullName); ElijahSoft soft = new ElijahSoft(fInfos[0].DirectoryName + "\\" + values[0], values[1], fInfos[0].DirectoryName + "\\" + values[2]); if (buttonCount > 4) { soft.Size = new Size(273, 75); } tab1.AddButton(soft); } catch { MessageBox.Show("加载某个软件时,出现错误" + fInfos[0].FullName); } } } } }
void ButtonClick(ElijahSoft Button) { try { #region 如果点击的工具已经在快捷按钮中,将这个按钮设置为第一个 bool isExist = false; int ButtonIndex = -1; for (int i = 1; i <= 5; i++) { string info = GetButton(i.ToString()); if (Button.SoftInfo == info) { isExist = true; ButtonIndex = i; break; } } if (isExist == true) { string info = GetButton(ButtonIndex.ToString()); for (int i = ButtonIndex; i > 1; i--) { SetButton(i.ToString(), GetButton(Convert.ToString(i - 1))); SetButtonInfo(i.ToString(), GetButton(Convert.ToString(i - 1))); } SetButton("1", info); SetButtonInfo("1", info); return; } #endregion //如果快捷按钮还没有放满,直接放到按钮中 if (buttonsCount < 5) { ++buttonsCount; SetButton(buttonsCount.ToString(), Button.SoftInfo); SetButtonInfo(buttonsCount.ToString(), Button.SoftInfo); } else { List <string> values = new List <string>(); for (int i = 1; i <= 5; i++) { values.Add(GetButton(i.ToString())); } values.Insert(0, Button.SoftInfo); values.RemoveAt(5); for (int i = 1; i <= 5; i++) { SetButton(i.ToString(), values[i - 1]); SetButtonInfo(i.ToString(), values[i - 1]); } } } catch { } }
void ElijahSoft_ButtonClick(ElijahSoft Button) { }
void ElijahSoft_ButtonClick(ElijahSoft Button) { }
private void SettionTab2() { string toolsPath = Application.StartupPath + @"\Softwares\PublicSofts\"; try { int toolCount = 0; if (Directory.Exists(toolsPath) == true) { DirectoryInfo dInfo = new DirectoryInfo(toolsPath); DirectoryInfo[] dInfos = dInfo.GetDirectories(); toolCount = dInfos.Count(); } if (toolCount > 0) { tab2.AddButton(new ElijahSoft(PublicToolNames.Excel) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Word) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Notepad) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Calculator) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Cmd) { Size = new Size(273, 75) }); } else { tab2.AddButton(new ElijahSoft(PublicToolNames.Excel)); tab2.AddButton(new ElijahSoft(PublicToolNames.Word)); tab2.AddButton(new ElijahSoft(PublicToolNames.Notepad)); tab2.AddButton(new ElijahSoft(PublicToolNames.Calculator)); tab2.AddButton(new ElijahSoft(PublicToolNames.Cmd)); } } catch { tab2.AddButton(new ElijahSoft(PublicToolNames.Excel) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Word) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Notepad) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Calculator) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Cmd) { Size = new Size(273, 75) }); } if (Directory.Exists(toolsPath) == true) { DirectoryInfo dInfo = new DirectoryInfo(toolsPath); DirectoryInfo[] dInfos = dInfo.GetDirectories(); for (int i = 0; i < dInfos.Count(); i++) { FileInfo[] fInfos = dInfos[i].GetFiles("SoftConfig.xml"); if (fInfos.Count() > 0) { try { string[] values = GetSoftInfo(fInfos[0].FullName); ElijahSoft soft = new ElijahSoft(fInfos[0].DirectoryName + "\\" + values[0], values[1], fInfos[0].DirectoryName + "\\" + values[2]); soft.Size = new Size(273, 75); tab2.AddButton(soft); } catch { MessageBox.Show("加载某个软件时,出现错误" + fInfos[0].FullName); } } } } }
private void SettionTab1() { string toolsPath = Application.StartupPath + @"\Softwares\ElijahSofts\"; if (Directory.Exists(toolsPath) == true) { DirectoryInfo dInfo = new DirectoryInfo(toolsPath); DirectoryInfo[] dInfos = dInfo.GetDirectories(); int buttonCount = dInfos.Count(); for (int i = 0; i < buttonCount; i++) { FileInfo[] fInfos = dInfos[i].GetFiles("SoftConfig.xml"); if (fInfos.Count() > 0) { try { string[] values = GetSoftInfo(fInfos[0].FullName); ElijahSoft soft = new ElijahSoft(fInfos[0].DirectoryName + "\\" + values[0], values[1], fInfos[0].DirectoryName + "\\" + values[2]); if (buttonCount > 4) { soft.Size = new Size(273, 75); } tab1.AddButton(soft); } catch { MessageBox.Show("加载某个软件时,出现错误" + fInfos[0].FullName); } } } } }
void ButtonClick(ElijahSoft Button) { try { #region 如果点击的工具已经在快捷按钮中,将这个按钮设置为第一个 bool isExist = false; int ButtonIndex = -1; for (int i = 1; i <= 5; i++) { string info = GetButton(i.ToString()); if (Button.SoftInfo == info) { isExist = true; ButtonIndex = i; break; } } if (isExist == true) { string info = GetButton(ButtonIndex.ToString()); for (int i = ButtonIndex; i >1; i--) { SetButton(i.ToString(),GetButton(Convert.ToString(i-1))); SetButtonInfo(i.ToString(), GetButton(Convert.ToString(i - 1))); } SetButton("1", info); SetButtonInfo("1", info); return; } #endregion //如果快捷按钮还没有放满,直接放到按钮中 if (buttonsCount < 5) { ++buttonsCount; SetButton(buttonsCount.ToString(), Button.SoftInfo); SetButtonInfo(buttonsCount.ToString(), Button.SoftInfo); } else { List<string> values = new List<string>(); for (int i = 1; i <= 5; i++) { values.Add(GetButton(i.ToString())); } values.Insert(0, Button.SoftInfo); values.RemoveAt(5); for (int i = 1; i <= 5; i++) { SetButton(i.ToString(), values[i - 1]); SetButtonInfo(i.ToString(), values[i - 1]); } } } catch { } }
private void SettionTab2() { string toolsPath = Application.StartupPath + @"\Softwares\PublicSofts\"; try { int toolCount = 0; if (Directory.Exists(toolsPath) == true) { DirectoryInfo dInfo = new DirectoryInfo(toolsPath); DirectoryInfo[] dInfos = dInfo.GetDirectories(); toolCount = dInfos.Count(); } if (toolCount > 0) { tab2.AddButton(new ElijahSoft(PublicToolNames.Excel) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Word) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Notepad) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Calculator) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Cmd) { Size = new Size(273, 75) }); } else { tab2.AddButton(new ElijahSoft(PublicToolNames.Excel)); tab2.AddButton(new ElijahSoft(PublicToolNames.Word)); tab2.AddButton(new ElijahSoft(PublicToolNames.Notepad)); tab2.AddButton(new ElijahSoft(PublicToolNames.Calculator)); tab2.AddButton(new ElijahSoft(PublicToolNames.Cmd)); } } catch { tab2.AddButton(new ElijahSoft(PublicToolNames.Excel) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Word) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Notepad) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Calculator) { Size = new Size(273, 75) }); tab2.AddButton(new ElijahSoft(PublicToolNames.Cmd) { Size = new Size(273, 75) }); } if (Directory.Exists(toolsPath) == true) { DirectoryInfo dInfo = new DirectoryInfo(toolsPath); DirectoryInfo[] dInfos = dInfo.GetDirectories(); for (int i = 0; i < dInfos.Count(); i++) { FileInfo[] fInfos = dInfos[i].GetFiles("SoftConfig.xml"); if (fInfos.Count() > 0) { try { string[] values = GetSoftInfo(fInfos[0].FullName); ElijahSoft soft = new ElijahSoft(fInfos[0].DirectoryName + "\\" + values[0], values[1], fInfos[0].DirectoryName + "\\" + values[2]); soft.Size = new Size(273, 75); tab2.AddButton(soft); } catch { MessageBox.Show("加载某个软件时,出现错误" + fInfos[0].FullName); } } } } }
void soft_ButtonClick(ElijahSoft Button) { this.ButtonClick(Button); }
public void AddButton(ElijahSoft soft) { soft.ButtonClick += new ElijahSoft._ButtonClick(soft_ButtonClick); this.panSofts.Controls.Add(soft); }
void TabElijahSoftware_ButtonClick(ElijahSoft Button) { }
void soft_ButtonClick(ElijahSoft Button) { this.ButtonClick(Button); }
public void AddButton(ElijahSoft soft) { soft.ButtonClick += new ElijahSoft._ButtonClick(soft_ButtonClick); this.panSofts.Controls.Add(soft); }
void TabElijahSoftware_ButtonClick(ElijahSoft Button) { }