StopWatch.CrossPlatformHelpers.IsWindowsEnvironment C# (CSharp) Method

IsWindowsEnvironment() public static method

public static IsWindowsEnvironment ( ) : bool
return bool
        public static bool IsWindowsEnvironment()
        {
            switch (Environment.OSVersion.Platform)
            {
                case PlatformID.Win32NT:
                case PlatformID.Win32S:
                case PlatformID.Win32Windows:
                case PlatformID.WinCE:
                    return true;
            }

            return false;
        }

Usage Example

示例#1
0
        public SettingsForm(Settings settings)
        {
            this.settings = settings;

            InitializeComponent();

            // Mono for MacOSX and Linux do not implement the notifyIcon
            // so ignore this feature if we are not running on Windows
            cbMinimizeToTray.Visible = CrossPlatformHelpers.IsWindowsEnvironment();

            tbJiraBaseUrl.Text = this.settings.JiraBaseUrl;
            tbUsername.Text    = settings.Username;
            tbApiToken.Text    = settings.ApiToken;

            cbAlwaysOnTop.Checked         = this.settings.AlwaysOnTop;
            cbMinimizeToTray.Checked      = this.settings.MinimizeToTray;
            cbAllowMultipleTimers.Checked = this.settings.AllowMultipleTimers;
            cbIncludeProjectName.Checked  = this.settings.IncludeProjectName;

            cbSaveTimerState.DisplayMember = "Text";
            cbSaveTimerState.ValueMember   = "Value";
            cbSaveTimerState.DataSource    = new[]
            {
                new { Text = "Reset all timers on exit", Value = SaveTimerSetting.NoSave },
                new { Text = "Save current timetracking, pause active timer", Value = SaveTimerSetting.SavePause },
                new { Text = "Save current timetracking, active timer continues", Value = SaveTimerSetting.SaveRunActive }
            };
            cbSaveTimerState.SelectedValue = this.settings.SaveTimerState;

            cbPauseOnSessionLock.DisplayMember = "Text";
            cbPauseOnSessionLock.ValueMember   = "Value";
            cbPauseOnSessionLock.DataSource    = new[]
            {
                new { Text = "No pause", Value = PauseAndResumeSetting.NoPause },
                new { Text = "Pause active timer", Value = PauseAndResumeSetting.Pause },
                new { Text = "Pause and resume on unlock", Value = PauseAndResumeSetting.PauseAndResume }
            };
            cbPauseOnSessionLock.SelectedValue = this.settings.PauseOnSessionLock;

            cbPostWorklogComment.DisplayMember = "Text";
            cbPostWorklogComment.ValueMember   = "Value";
            cbPostWorklogComment.DataSource    = new[]
            {
                new { Text = "Post only as part of worklog", Value = WorklogCommentSetting.WorklogOnly },
                new { Text = "Post only as a comment", Value = WorklogCommentSetting.CommentOnly },
                new { Text = "Post as both worklog and comment", Value = WorklogCommentSetting.WorklogAndComment }
            };
            cbPostWorklogComment.SelectedValue = this.settings.PostWorklogComment;

            tbStartTransitions.Text = this.settings.StartTransitions;

            cbLoggingEnabbled.Checked = this.settings.LoggingEnabled;

            cbCheckForUpdate.Checked = settings.CheckForUpdate;
        }
All Usage Examples Of StopWatch.CrossPlatformHelpers::IsWindowsEnvironment
CrossPlatformHelpers