internal static void SetWindowsJumpList(Form1 form) { #if Debug return; #endif try { switch (GetOSInfo()) { case OS.Seven: { if (!ConfigUtil.GetBoolParameter("RecreateJumpList") || !ConfigUtil.GetBoolParameter("ActiveJumpList")) { return; } JumpList list = JumpList.CreateJumpListForIndividualWindow(ConstantUtil.jumpListApplicationId, form.Handle); JumpListSeparator separator = null; JumpListLink listLink = null; try { separator = new JumpListSeparator(); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("New", className)); listLink.Arguments = ConstantUtil.cmdLineJLNew; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\NewTab.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("NewAndPaste", className)); listLink.Arguments = ConstantUtil.cmdLineJLNewAndPaste; listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("OpenFile", className)); listLink.Arguments = ConstantUtil.cmdLineJLOpenFile; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\OpenFile.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("OpenSession", className)); listLink.Arguments = ConstantUtil.cmdLineJLOpenSession; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\OpenSession.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("SearchInFiles", className)); listLink.Arguments = ConstantUtil.cmdLineJLSearchInFiles; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\SearchInFiles.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); list.AddUserTasks(separator); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("CheckNewVersion", className)); listLink.Arguments = ConstantUtil.cmdLineJLCheckNewVersion; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\CheckNewVersion.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); #if Release listLink = new JumpListLink(ConstantUtil.dtPadURL, LanguageUtil.GetCurrentLanguageString("WebSite", className)); listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\WebSite.ico", ConstantUtil.ApplicationExecutionPath()), 0); list.AddUserTasks(listLink); #endif list.Refresh(); } finally { if (separator != null) { separator.Dispose(); } if (listLink != null) { listLink.Dispose(); } } ConfigUtil.UpdateParameter("RecreateJumpList", false.ToString()); } break; } } catch (Exception exception) { WindowManager.ShowErrorBox(form, exception.Message, exception); } }
internal static String GetCurrentLanguageString(String name, String resource, int counter) { try { ResourceManager resourceManager = ResourceManager.CreateFileBasedResourceManager(GetReallyShortCulture(), Path.Combine(ConstantUtil.ApplicationExecutionPath(), "Languages"), null); return(resourceManager.GetString(counter == 1 ? String.Format("{0}_{1}One", resource, name) : String.Format("{0}_{1}More", resource, name))); } catch (Exception exception) { LanguageException languageException = new LanguageException(String.Format("Error during language resource reading: {0}", exception.Message)); throw languageException; } }