Beispiel #1
0
        internal static bool GetBoolParameter(String parameterName)
        {
            try
            {
                String parameterValue = ConfigurationManager.AppSettings[parameterName];
                if (parameterValue == null)
                {
                    throw new ConfigException(String.Format(LanguageUtil.GetCurrentLanguageString("NoValue", className), parameterName));
                }

                return(Convert.ToBoolean(parameterValue));
            }
            catch (Exception)
            {
                String parameterDefault = ConstantUtil.GetAppConfigDefault(parameterName);
                UpdateParameter(parameterName, parameterDefault);
                return(Convert.ToBoolean(parameterDefault));
            }
        }
Beispiel #2
0
        internal static void GetDefaultPath(Options form)
        {
            FolderBrowserDialog folderBrowserDialog   = form.folderBrowserDialog;
            TextBox             specificFolderTextBox = form.specificFolderTextBox;

            folderBrowserDialog.Description = LanguageUtil.GetCurrentLanguageString("folderDialogDefault", className);

            if (Directory.Exists(specificFolderTextBox.Text))
            {
                folderBrowserDialog.SelectedPath = specificFolderTextBox.Text;
            }
            else
            {
                folderBrowserDialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            }

            if (form.folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                specificFolderTextBox.Text = folderBrowserDialog.SelectedPath;
            }
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        internal static String GetOSDescription(OS operatingSystem)
        {
            String osDescription;

            switch (operatingSystem)
            {
            case OS.ThreeOne:
                osDescription = "Windows 3.1";
                break;

            case OS.Ce:
                osDescription = "Windows CE";
                break;

            case OS.NinetyFive:
                osDescription = "Windows 95";
                break;

            case OS.NinetyEight:
                osDescription = "Windows 98";
                break;

            case OS.NinetyEightSe:
                osDescription = "Windows 98 Second Edition";
                break;

            case OS.Me:
                osDescription = "Windows Millennium Edition";
                break;

            case OS.NtThreeFiveOne:
                osDescription = "Windows NT 3.51";
                break;

            case OS.NtFour:
                osDescription = "Windows NT 4.0";
                break;

            case OS.NtFourServer:
                osDescription = "Windows NT 4.0 Server";
                break;

            case OS.TwoThousand:
                osDescription = "Windows 2000";
                break;

            case OS.Xp:
                osDescription = "Windows XP";
                break;

            case OS.ServerTwoThousandThree:
                osDescription = "Windows Server 2003";
                break;

            case OS.Vista:
                osDescription = "Windows Vista";
                break;

            case OS.ServerTwoThousandEight:
                osDescription = "Windows Server 2008";
                break;

            case OS.Seven:
                osDescription = "Windows 7";
                break;

            case OS.ServerTwoThousandEightR2:
                osDescription = "Windows Server 2008 R2";
                break;

            case OS.Eight:
                osDescription = "Windows 8";
                break;

            case OS.ServerTwoThousandTwelve:
                osDescription = "Windows Server 2012";
                break;

            default:
                osDescription = LanguageUtil.GetCurrentLanguageString("OSOther", className);
                break;
            }

            return(osDescription);
        }