| | |
| | | |
| | | public void InvokeByCode(int code) |
| | | { |
| | | LogOut.Info("InvokeByCode > " + code); |
| | | LogOut.Info("InvokeByCode > 0x" + code.ToString("x")); |
| | | switch (code) |
| | | { |
| | | case 0xc0: // 重置鼠标模式 |
| | |
| | | #region 方案管理 |
| | | private void Save() |
| | | { |
| | | //SG.Command.Execute(1003, null); |
| | | SaveLocation(); |
| | | this.SG.Project.Save(); |
| | | this.SG.Command.Execute(1019, 0); // Capture Tree State |
| | | SG.Command.Execute(1003, 0); // this.SG.Project.Save(); |
| | | } |
| | | |
| | | private void SaveAs(string flyPath) |
| | | { |
| | | SaveLocation(); |
| | | this.SG.Command.Execute(1019, 0); // Capture Tree State |
| | | this.SG.Project.SaveAs(flyPath); |
| | | } |
| | | |
| | | private void OpenPrj() |
| | | { |
| | | string flyPath = ReadPrjPath(); |
| | | if (String.IsNullOrEmpty(flyPath)) flyPath = Path.Combine(mainUrl, "see.fly"); |
| | | if (String.IsNullOrEmpty(flyPath)) flyPath = this.fly; // flyPath = Path.Combine(mainUrl, "see.fly"); |
| | | |
| | | if (!File.Exists(flyPath)) |
| | | { |
| | |
| | | try |
| | | { |
| | | string flyPath = ReadPrjPath(); |
| | | if (String.IsNullOrEmpty(flyPath)) flyPath = Path.Combine(mainUrl, "see.fly"); |
| | | if (String.IsNullOrEmpty(flyPath)) flyPath = this.fly; // flyPath = Path.Combine(mainUrl, "see.fly"); |
| | | |
| | | this.Save(); |
| | | //this.SG.Project.SaveAs(flyPath); |
| | | if (this.fly.Equals(flyPath)) return; |
| | | if (File.Exists(flyPath)) File.Delete(flyPath); |
| | | |
| | | string cmd = string.Format("mklink \"{0}\" \"{1}\"", flyPath, this.fly); |
| | | ExecCmd(new List<string> { cmd }); |
| | | //string cmd = string.Format("mklink \"{0}\" \"{1}\"", flyPath, this.fly); |
| | | //ExecCmd(new List<string> { cmd }); |
| | | CreateShortcut(flyPath, this.fly); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private String GetSavePath() |
| | | { |
| | | string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); |
| | | string tePathName = ConfigurationManager.AppSettings["tePath"].Contains("SmartEarth") ? "SmartEarth" : "Skyline"; |
| | | |
| | | return Path.Combine(appData, tePathName, "TerraExplorer"); |
| | | } |
| | | |
| | | public static void CreateShortcut(string shortcutPath, string targetPath, string description = null, string iconLocation = null) |
| | | { |
| | | var shell = new IWshRuntimeLibrary.WshShell(); |
| | | var shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutPath + ".lnk"); // 创建快捷方式对象 |
| | | shortcut.TargetPath = targetPath; // 指定目标路径 |
| | | shortcut.WorkingDirectory = Path.GetDirectoryName(targetPath); // 设置起始位置 |
| | | shortcut.WindowStyle = 1; // 设置运行方式,默认为常规窗口 |
| | | shortcut.Description = description; // 设置备注 |
| | | shortcut.IconLocation = string.IsNullOrWhiteSpace(iconLocation) ? targetPath : iconLocation; // 设置图标路径 |
| | | shortcut.Save(); // 保存快捷方式 |
| | | } |
| | | #endregion |
| | | } |
| | | } |