Example #1
0
 internal JiraTimerCollection(ISettingsCollection settingsCollection, ITrackUsage trackUsage)
 {
     this.settingsCollection = settingsCollection;
     this.trackUsage         = trackUsage;
     timerList    = new List <JiraTimer>();
     isIntialised = false;
 }
Example #2
0
        public SettingModel(ISettingsCollection settings, IVersionControl versionControl)
        {
            //Static Data
            AvaliableThemes = ThemeManager.AppThemes.Select(x => new AccentThemeModel { Name = x.Name.Replace("Base", ""), Colour = x.Resources["WhiteColorBrush"] as Brush, BorderColour = x.Resources["BlackColorBrush"] as Brush }).ToList();
            AvaliableAccents = ThemeManager.Accents.Select(x => new AccentThemeModel { Name = x.Name, Colour = x.Resources["AccentColorBrush"] as Brush, BorderColour = x.Resources["AccentColorBrush"] as Brush }).ToList();

            //AppSettings
            AlertWhenIdle = settings.AppSettings.AlertWhenNotRunning;
            AlertMinutes = (int)TimeSpan.FromMilliseconds(settings.AppSettings.AlertTimeMilliseconds).TotalMinutes;
            TrackIdle = settings.AppSettings.TrackIdleTime;
            TrackIdleThresholdMinutes = (int)TimeSpan.FromMilliseconds(settings.AppSettings.IdleTimeThresholdMilliseconds).TotalMinutes;
            TrackLock = settings.AppSettings.TrackLockTime;
            TrackLockThresholdMinutes = (int)TimeSpan.FromMilliseconds(settings.AppSettings.LockTimeThresholdMilliseconds).TotalMinutes;
            KeepTimersForDays = settings.AppSettings.KeepTimersForDays;
            AutoUpdate = settings.AppSettings.AutoUpdate;
            AllowTracking = settings.AppSettings.UsageTracking;
            TargetHoursPerDay = settings.AppSettings.TargetLogPerDay.Hours;
            TargetMinutesPerDay = settings.AppSettings.TargetLogPerDay.Minutes;
            StartOfWeek = settings.AppSettings.StartOfWeek.ToString();
            DefaultTimers = string.Join(",", settings.AppSettings.DefaultTimers ?? new List<string>());

            WorkingDays = new List<WorkingDay>();
            foreach (DayOfWeek dayOfWeek in Enum.GetValues(typeof(DayOfWeek)))
            {
                var isChecked = settings.AppSettings.ExportDays.Contains(dayOfWeek);
                WorkingDays.Add(new WorkingDay(isChecked, dayOfWeek));
            }

            //UI Settings
            Theme = AvaliableThemes.FirstOrDefault(x => x.Name == settings.UiSettings.Theme) ?? AvaliableThemes.First();
            Accent = AvaliableAccents.FirstOrDefault(x => x.Name == settings.UiSettings.Accent) ?? AvaliableAccents.First();
            StartOnBoot = versionControl.IsAutomatedDeploy && registryKey.GetValue(versionControl.AppName) != null;
            TopMostOnFlyoutOpen = settings.UiSettings.TopMostOnFlyoutOpen;

            //Jira Settings
            JiraUrl = settings.JiraConnectionSettings.JiraUrl;
            JiraUsername = settings.JiraConnectionSettings.JiraUsername;
            JiraPassword = settings.JiraConnectionSettings.JiraPassword;

            //Export Settings
            TrackingOnly = settings.ExportSettings.TrackingOnly;
            ExportAll = settings.ExportSettings.ExportPromptAll;
            ExportPrompts = new List<ExportPrompt>
            {
                new ExportPrompt("Locked", settings.ExportSettings.ExportPrompt.OnAddIdle, "Add Locked Time"),
                new ExportPrompt("Manual", settings.ExportSettings.ExportPrompt.OnManualAdjust, "Manual Timer Adjustment"),
                new ExportPrompt("Stop", settings.ExportSettings.ExportPrompt.OnStop, "Stop Timer"),
                new ExportPrompt("Pre", settings.ExportSettings.ExportPrompt.OnCreatePreloaded, "Add Pre-Loaded Timer"),
            };

            RemainingAdjustmentValues = new List<RemainingAdjustmentValue>
            {
                new RemainingAdjustmentValue(DefaultRemaining.Auto, "Adjust Automatically"),
                new RemainingAdjustmentValue(DefaultRemaining.Leave, "Leave Remaining"),
                new RemainingAdjustmentValue(DefaultRemaining.Set, "Set Value")
            };
            SelectedRemainingAdjustmentValue = RemainingAdjustmentValues.First(x => x.Remaining == settings.ExportSettings.DefaultRemainingValue);
            CommentPrefix = settings.ExportSettings.ExportCommentPrefix;
            DefaultComment = settings.ExportSettings.EmptyExportComment;
        }
Example #3
0
 public TrackUsage(IVersionControl versionControl, ISettingsCollection settingsCollection, InstanceType instanceType)
 {
     this.versionControl     = versionControl;
     this.settingsCollection = settingsCollection;
     this.instanceType       = instanceType;
     SetupBrowser();
     TrackAppUsage(TrackingType.AppLoad);
 }
Example #4
0
        public SettingModel(ISettingsCollection settings, IVersionControl versionControl)
        {
            //Static Data
            AvaliableThemes = ThemeManager.AppThemes.Select(x => new AccentThemeModel {
                Name = x.Name.Replace("Base", ""), Colour = x.Resources["WhiteColorBrush"] as Brush, BorderColour = x.Resources["BlackColorBrush"] as Brush
            }).ToList();
            AvaliableAccents = ThemeManager.Accents.Select(x => new AccentThemeModel {
                Name = x.Name, Colour = x.Resources["AccentColorBrush"] as Brush, BorderColour = x.Resources["AccentColorBrush"] as Brush
            }).ToList();

            //AppSettings
            AlertWhenIdle       = settings.AppSettings.AlertWhenNotRunning;
            AlertMinutes        = (settings.AppSettings.AlertTimeMilliseconds / 1000 / 60);
            KeepTimersForDays   = settings.AppSettings.KeepTimersForDays;
            AutoUpdate          = settings.AppSettings.AutoUpdate;
            AllowTracking       = settings.AppSettings.UsageTracking;
            TargetHoursPerDay   = settings.AppSettings.TargetLogPerDay.Hours;
            TargetMinutesPerDay = settings.AppSettings.TargetLogPerDay.Minutes;
            StartOfWeek         = settings.AppSettings.StartOfWeek.ToString();

            WorkingDays = new List <WorkingDay>();
            foreach (DayOfWeek dayOfWeek in Enum.GetValues(typeof(DayOfWeek)))
            {
                var isChecked = settings.AppSettings.ExportDays.Contains(dayOfWeek);
                WorkingDays.Add(new WorkingDay(isChecked, dayOfWeek));
            }

            //UI Settings
            Theme       = AvaliableThemes.FirstOrDefault(x => x.Name == settings.UiSettings.Theme) ?? AvaliableThemes.First();
            Accent      = AvaliableAccents.FirstOrDefault(x => x.Name == settings.UiSettings.Accent) ?? AvaliableAccents.First();
            StartOnBoot = versionControl.IsAutomatedDeploy && registryKey.GetValue(versionControl.AppName) != null;

            //Jira Settings
            JiraUrl      = settings.JiraConnectionSettings.JiraUrl;
            JiraUsername = settings.JiraConnectionSettings.JiraUsername;
            JiraPassword = settings.JiraConnectionSettings.JiraPassword;

            //Export Settings
            ExportAll     = settings.ExportSettings.ExportPromptAll;
            ExportPrompts = new List <ExportPrompt>
            {
                new ExportPrompt("Idle", settings.ExportSettings.ExportPrompt.OnAddIdle, "Add Idle Time"),
                new ExportPrompt("Manual", settings.ExportSettings.ExportPrompt.OnManualAdjust, "Manual Timer Adjustment"),
                new ExportPrompt("Stop", settings.ExportSettings.ExportPrompt.OnStop, "Stop Timer"),
                new ExportPrompt("Pre", settings.ExportSettings.ExportPrompt.OnCreatePreloaded, "Add Pre-Loaded Timer"),
            };

            RemainingAdjustmentValues = new List <RemainingAdjustmentValue>
            {
                new RemainingAdjustmentValue(DefaultRemaining.Auto, "Adjust Automatically"),
                new RemainingAdjustmentValue(DefaultRemaining.Leave, "Leave Remaining"),
                new RemainingAdjustmentValue(DefaultRemaining.Set, "Set Value")
            };
            SelectedRemainingAdjustmentValue = RemainingAdjustmentValues.First(x => x.Remaining == settings.ExportSettings.DefaultRemainingValue);
            CommentPrefix  = settings.ExportSettings.ExportCommentPrefix;
            DefaultComment = settings.ExportSettings.EmptyExportComment;
        }
Example #5
0
        public static T GetSettings <T>(this ISettingsCollection target) where T : class
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            return((T)target.GetSettings(typeof(T)));
        }
Example #6
0
 //It checks on what plugin you have
 private void OnGetReceiver(IServerManager server, uint id, string type, ISettingsCollection configuration, ref IReceiver receiver)
 {
     if (type == "SDRSharp")
     {
         int       PIN  = 1234; //Our PIN
         HamaParse hama = new HamaParse("192.168.88.11", PIN);
         receiver = new GTRadio(this, hama);
     }
 }
Example #7
0
        public SettingsCollection(ISettingsCollection settings)
        {
            AppSettings            = settings.AppSettings;
            JiraConnectionSettings = settings.JiraConnectionSettings;
            UiSettings             = settings.UiSettings;
            InternalSettings       = settings.InternalSettings;
            ExportSettings         = settings.ExportSettings;

            isIntialised = false;
        }
Example #8
0
        internal ActivityChecker(IJiraTimerCollection timerCollection, ISettingsCollection settingsCollection)
        {
            activityStopwatch       = new ActivityStopwatch();
            this.timerCollection    = timerCollection;
            this.settingsCollection = settingsCollection;
            lockObject = new object();

            hearbeat          = new Timer(500);
            hearbeat.Elapsed += HearbeatOnElapsed;
            hearbeat.Start();
        }
Example #9
0
        public void UpdateSettings(ISettingsCollection settings, IVersionControl versionControl)
        {
            //AppSettings
            settings.AppSettings.AlertWhenNotRunning   = AlertWhenIdle;
            settings.AppSettings.AlertTimeMilliseconds = AlertMinutes * 60 * 1000;
            settings.AppSettings.KeepTimersForDays     = KeepTimersForDays;
            settings.AppSettings.AutoUpdate            = AutoUpdate;
            settings.AppSettings.UsageTracking         = AllowTracking;
            settings.AppSettings.TargetLogPerDay       = new TimeSpan(TargetHoursPerDay, TargetMinutesPerDay, 0);
            settings.AppSettings.ExportDays            = WorkingDays.Where(x => x.IsChecked).Select(x => x.DayOfWeek).ToList();
            settings.AppSettings.StartOfWeek           = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), StartOfWeek, true);

            //UI Settings
            settings.UiSettings.Theme  = Theme.Name;
            settings.UiSettings.Accent = Accent.Name;
            if (versionControl.IsAutomatedDeploy)
            {
                if (StartOnBoot)
                {
                    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "Gallifrey", $"{versionControl.AppName}.appref-ms");
                    registryKey.SetValue(versionControl.AppName, path);
                }
                else
                {
                    registryKey.DeleteValue(versionControl.AppName, false);
                }
            }

            //Jira Settings
            if (settings.JiraConnectionSettings.JiraUrl != JiraUrl ||
                settings.JiraConnectionSettings.JiraUsername != JiraUsername ||
                settings.JiraConnectionSettings.JiraPassword != JiraPassword)
            {
                JiraSettingsChanged = true;
            }
            else if (string.IsNullOrWhiteSpace(JiraUrl) || string.IsNullOrWhiteSpace(JiraUsername) || string.IsNullOrWhiteSpace(JiraPassword))
            {
                JiraSettingsChanged = true;
            }

            settings.JiraConnectionSettings.JiraUrl      = JiraUrl;
            settings.JiraConnectionSettings.JiraUsername = JiraUsername;
            settings.JiraConnectionSettings.JiraPassword = JiraPassword;

            //Export Settings
            settings.ExportSettings.ExportPrompt.OnAddIdle         = ExportPrompts.First(x => x.Key == "Idle").IsChecked;
            settings.ExportSettings.ExportPrompt.OnManualAdjust    = ExportPrompts.First(x => x.Key == "Manual").IsChecked;
            settings.ExportSettings.ExportPrompt.OnStop            = ExportPrompts.First(x => x.Key == "Stop").IsChecked;
            settings.ExportSettings.ExportPrompt.OnCreatePreloaded = ExportPrompts.First(x => x.Key == "Pre").IsChecked;
            settings.ExportSettings.ExportPromptAll       = ExportAll;
            settings.ExportSettings.DefaultRemainingValue = SelectedRemainingAdjustmentValue.Remaining;
            settings.ExportSettings.ExportCommentPrefix   = CommentPrefix;
            settings.ExportSettings.EmptyExportComment    = DefaultComment;
        }
Example #10
0
 public TrackUsage(IVersionControl versionControl, ISettingsCollection settingsCollection, InstanceType instanceType)
 {
     this.versionControl     = versionControl;
     this.settingsCollection = settingsCollection;
     this.instanceType       = instanceType;
     tracker = new SimpleTracker("UA-51628201-7", new SimpleTrackerEnvironment(Environment.OSVersion.Platform.ToString(), Environment.OSVersion.Version.ToString(), Environment.OSVersion.VersionString));
     TrackAppUsage(TrackingType.AppLoad);
     heartbeat          = new Timer(TimeSpan.FromMinutes(1).TotalMilliseconds);
     heartbeat.Elapsed += (sender, args) => TrackAppUsage(TrackingType.Heartbeat);
     heartbeat.Enabled  = true;
 }
Example #11
0
        public SettingModel(ISettingsCollection settings)
        {
            //AppSettings
            AlertWhenIdle = settings.AppSettings.AlertWhenNotRunning;
            AlertMinutes = (settings.AppSettings.AlertTimeMilliseconds / 1000 / 60);
            KeepTimersForDays = settings.AppSettings.KeepTimersForDays;
            AutoUpdate = settings.AppSettings.AutoUpdate;
            AllowTracking = settings.AppSettings.UsageTracking;
            TargetHoursPerDay = settings.AppSettings.TargetLogPerDay.Hours;
            TargetMinutesPerDay = settings.AppSettings.TargetLogPerDay.Minutes;
            StartOfWeek = settings.AppSettings.StartOfWeek.ToString();

            WorkingDays = new List<WorkingDay>();
            foreach (DayOfWeek dayOfWeek in Enum.GetValues(typeof(DayOfWeek)))
            {
                var isChecked = settings.AppSettings.ExportDays.Contains(dayOfWeek);
                WorkingDays.Add(new WorkingDay(isChecked, dayOfWeek));
            }

            //UI Settings
            Theme = settings.UiSettings.Theme;

            //Jira Settings
            JiraUrl = settings.JiraConnectionSettings.JiraUrl;
            JiraUsername = settings.JiraConnectionSettings.JiraUsername;
            JiraPassword = settings.JiraConnectionSettings.JiraPassword;

            //Export Settings
            ExportAll = settings.ExportSettings.ExportPromptAll;
            ExportPrompts = new List<ExportPrompt>
            {
                new ExportPrompt("Idle", settings.ExportSettings.ExportPrompt.OnAddIdle, "Add Idle Time"),
                new ExportPrompt("Manual", settings.ExportSettings.ExportPrompt.OnManualAdjust, "Manual Timer Adjustment"),
                new ExportPrompt("Stop", settings.ExportSettings.ExportPrompt.OnStop, "Stop Timer"),
                new ExportPrompt("Pre", settings.ExportSettings.ExportPrompt.OnCreatePreloaded, "Add Pre-Loaded Timer"),
            };

            RemainingAdjustmentValues = new List<RemainingAdjustmentValue>
            {
                new RemainingAdjustmentValue(DefaultRemaining.Auto, "Adjust Automatically"),
                new RemainingAdjustmentValue(DefaultRemaining.Leave, "Leave Remaining"),
                new RemainingAdjustmentValue(DefaultRemaining.Set, "Set Value")
            };
            SelectedRemainingAdjustmentValue = RemainingAdjustmentValues.First(x => x.Remaining == settings.ExportSettings.DefaultRemainingValue);
            CommentPrefix = settings.ExportSettings.ExportCommentPrefix;
            DefaultComment = settings.ExportSettings.EmptyExportComment;

            //Static Data
            AvaliableThemes = ThemeManager.AppThemes.Select(x => x.Name.Replace("Base", "")).ToList();
        }
Example #12
0
        public void UpdateSettings(ISettingsCollection settings)
        {
            //AppSettings
            settings.AppSettings.AlertWhenNotRunning   = AlertWhenIdle;
            settings.AppSettings.AlertTimeMilliseconds = AlertMinutes * 60 * 1000;
            settings.AppSettings.KeepTimersForDays     = KeepTimersForDays;
            settings.AppSettings.AutoUpdate            = AutoUpdate;
            settings.AppSettings.UsageTracking         = AllowTracking;
            settings.AppSettings.TargetLogPerDay       = new TimeSpan(TargetHoursPerDay, TargetMinutesPerDay, 0);
            settings.AppSettings.ExportDays            = WorkingDays.Where(x => x.IsChecked).Select(x => x.DayOfWeek);
            settings.AppSettings.StartOfWeek           = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), StartOfWeek, true);

            //UI Settings
            settings.UiSettings.Theme = Theme;

            //Jira Settings
            if (settings.JiraConnectionSettings.JiraUrl != JiraUrl ||
                settings.JiraConnectionSettings.JiraUsername != JiraUsername ||
                settings.JiraConnectionSettings.JiraPassword != JiraPassword)
            {
                JiraSettingsChanged = true;
            }

            settings.JiraConnectionSettings.JiraUrl      = JiraUrl;
            settings.JiraConnectionSettings.JiraUsername = JiraUsername;
            settings.JiraConnectionSettings.JiraPassword = JiraPassword;

            //Export Settings
            settings.ExportSettings.ExportPrompt.OnAddIdle         = ExportPrompts.First(x => x.Key == "Idle").IsChecked;
            settings.ExportSettings.ExportPrompt.OnManualAdjust    = ExportPrompts.First(x => x.Key == "Manual").IsChecked;
            settings.ExportSettings.ExportPrompt.OnStop            = ExportPrompts.First(x => x.Key == "Stop").IsChecked;
            settings.ExportSettings.ExportPrompt.OnCreatePreloaded = ExportPrompts.First(x => x.Key == "Pre").IsChecked;
            settings.ExportSettings.ExportPromptAll       = ExportAll;
            settings.ExportSettings.DefaultRemainingValue = SelectedRemainingAdjustmentValue.Remaining;
            settings.ExportSettings.ExportCommentPrefix   = CommentPrefix;
            settings.ExportSettings.EmptyExportComment    = DefaultComment;
        }
Example #13
0
        public void UpdateSettings(ISettingsCollection settings)
        {
            //AppSettings
            settings.AppSettings.AlertWhenNotRunning = AlertWhenIdle;
            settings.AppSettings.AlertTimeMilliseconds = AlertMinutes * 60 * 1000;
            settings.AppSettings.KeepTimersForDays = KeepTimersForDays;
            settings.AppSettings.AutoUpdate = AutoUpdate;
            settings.AppSettings.UsageTracking = AllowTracking;
            settings.AppSettings.TargetLogPerDay = new TimeSpan(TargetHoursPerDay, TargetMinutesPerDay, 0);
            settings.AppSettings.ExportDays = WorkingDays.Where(x => x.IsChecked).Select(x => x.DayOfWeek);
            settings.AppSettings.StartOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), StartOfWeek, true);

            //UI Settings
            settings.UiSettings.Theme = Theme;

            //Jira Settings
            if (settings.JiraConnectionSettings.JiraUrl != JiraUrl ||
                settings.JiraConnectionSettings.JiraUsername != JiraUsername ||
                settings.JiraConnectionSettings.JiraPassword != JiraPassword)
            {
                JiraSettingsChanged = true;
            }

            settings.JiraConnectionSettings.JiraUrl = JiraUrl;
            settings.JiraConnectionSettings.JiraUsername = JiraUsername;
            settings.JiraConnectionSettings.JiraPassword = JiraPassword;

            //Export Settings
            settings.ExportSettings.ExportPrompt.OnAddIdle = ExportPrompts.First(x => x.Key == "Idle").IsChecked;
            settings.ExportSettings.ExportPrompt.OnManualAdjust = ExportPrompts.First(x => x.Key == "Manual").IsChecked;
            settings.ExportSettings.ExportPrompt.OnStop = ExportPrompts.First(x => x.Key == "Stop").IsChecked;
            settings.ExportSettings.ExportPrompt.OnCreatePreloaded = ExportPrompts.First(x => x.Key == "Pre").IsChecked;
            settings.ExportSettings.ExportPromptAll = ExportAll;
            settings.ExportSettings.DefaultRemainingValue = SelectedRemainingAdjustmentValue.Remaining;
            settings.ExportSettings.ExportCommentPrefix = CommentPrefix;
            settings.ExportSettings.EmptyExportComment = DefaultComment;
        }
Example #14
0
 public SettingsCollectionTypeDescriptor(ISettingsCollection target)
     : base(GetTypeDescriptor(target))
 {
     this.Target = target;
 }
Example #15
0
 void IReceiver.Configure(ISettingsCollection Config) //Configuration
 {
 }
Example #16
0
        public void UpdateSettings(ISettingsCollection settings, IVersionControl versionControl)
        {
            //AppSettings
            settings.AppSettings.AlertWhenNotRunning = AlertWhenIdle;
            settings.AppSettings.AlertTimeMilliseconds = AlertWhenIdle ? (int)TimeSpan.FromMinutes((AlertMinutes ?? 1)).TotalMilliseconds : 0;
            settings.AppSettings.TrackIdleTime = TrackIdle;
            settings.AppSettings.IdleTimeThresholdMilliseconds = TrackIdle ? (int)TimeSpan.FromMinutes((TrackIdleThresholdMinutes ?? 1)).TotalMilliseconds : 0;
            settings.AppSettings.TrackLockTime = TrackLock;
            settings.AppSettings.LockTimeThresholdMilliseconds = TrackLock ? (int)TimeSpan.FromMinutes((TrackLockThresholdMinutes ?? 1)).TotalMilliseconds : 0;
            settings.AppSettings.KeepTimersForDays = KeepTimersForDays ?? 7;
            settings.AppSettings.AutoUpdate = AutoUpdate;
            settings.AppSettings.UsageTracking = AllowTracking;
            settings.AppSettings.TargetLogPerDay = new TimeSpan(TargetHoursPerDay ?? 0, TargetMinutesPerDay ?? 0, 0);
            settings.AppSettings.ExportDays = WorkingDays.Where(x => x.IsChecked).Select(x => x.DayOfWeek).ToList();
            settings.AppSettings.StartOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), StartOfWeek, true);
            settings.AppSettings.DefaultTimers = DefaultTimers.Split(',').SelectMany(x => x.Split(' ')).Where(x=>!string.IsNullOrWhiteSpace(x)).ToList();

            //UI Settings
            settings.UiSettings.Theme = Theme.Name;
            settings.UiSettings.Accent = Accent.Name;
            if (versionControl.IsAutomatedDeploy)
            {
                if (StartOnBoot)
                {
                    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "Gallifrey", $"{versionControl.AppName}.appref-ms");
                    registryKey.SetValue(versionControl.AppName, path);
                }
                else
                {
                    registryKey.DeleteValue(versionControl.AppName, false);
                }
            }
            settings.UiSettings.TopMostOnFlyoutOpen = TopMostOnFlyoutOpen;

            //Jira Settings
            if (settings.JiraConnectionSettings.JiraUrl != JiraUrl ||
                settings.JiraConnectionSettings.JiraUsername != JiraUsername ||
                settings.JiraConnectionSettings.JiraPassword != JiraPassword)
            {
                JiraSettingsChanged = true;
            }
            else if (string.IsNullOrWhiteSpace(JiraUrl) || string.IsNullOrWhiteSpace(JiraUsername) || string.IsNullOrWhiteSpace(JiraPassword))
            {
                JiraSettingsChanged = true;
            }

            settings.JiraConnectionSettings.JiraUrl = JiraUrl;
            settings.JiraConnectionSettings.JiraUsername = JiraUsername;
            settings.JiraConnectionSettings.JiraPassword = JiraPassword;

            //Export Settings
            settings.ExportSettings.ExportPrompt.OnAddIdle = ExportPrompts.First(x => x.Key == "Locked").IsChecked && !TrackingOnly;
            settings.ExportSettings.ExportPrompt.OnManualAdjust = ExportPrompts.First(x => x.Key == "Manual").IsChecked && !TrackingOnly;
            settings.ExportSettings.ExportPrompt.OnStop = ExportPrompts.First(x => x.Key == "Stop").IsChecked && !TrackingOnly;
            settings.ExportSettings.ExportPrompt.OnCreatePreloaded = ExportPrompts.First(x => x.Key == "Pre").IsChecked && !TrackingOnly;
            settings.ExportSettings.ExportPromptAll = ExportAll;
            settings.ExportSettings.DefaultRemainingValue = SelectedRemainingAdjustmentValue.Remaining;
            settings.ExportSettings.ExportCommentPrefix = CommentPrefix;
            settings.ExportSettings.EmptyExportComment = DefaultComment;
            settings.ExportSettings.TrackingOnly = TrackingOnly;
        }
Example #17
0
 internal JiraTimerCollection(ISettingsCollection settingsCollection, ITrackUsage trackUsage)
 {
     this.settingsCollection = settingsCollection;
     this.trackUsage         = trackUsage;
     timerList = JiraTimerCollectionSerializer.DeSerialize();
 }
Example #18
0
        public void UpdateSettings(ISettingsCollection settings, IVersionControl versionControl)
        {
            //AppSettings
            settings.AppSettings.AlertWhenNotRunning           = AlertWhenIdle;
            settings.AppSettings.AlertTimeMilliseconds         = AlertWhenIdle ? (int)TimeSpan.FromMinutes((AlertMinutes ?? 1)).TotalMilliseconds : 0;
            settings.AppSettings.TrackIdleTime                 = TrackIdle;
            settings.AppSettings.IdleTimeThresholdMilliseconds = TrackIdle ? (int)TimeSpan.FromMinutes((TrackIdleThresholdMinutes ?? 1)).TotalMilliseconds : 0;
            settings.AppSettings.TrackLockTime                 = TrackLock;
            settings.AppSettings.LockTimeThresholdMilliseconds = TrackLock ? (int)TimeSpan.FromMinutes((TrackLockThresholdMinutes ?? 1)).TotalMilliseconds : 0;
            settings.AppSettings.KeepTimersForDays             = KeepTimersForDays ?? 7;
            settings.AppSettings.AutoUpdate      = AutoUpdate;
            settings.AppSettings.TargetLogPerDay = new TimeSpan(TargetHoursPerDay ?? 0, TargetMinutesPerDay ?? 0, 0);
            settings.AppSettings.ExportDays      = WorkingDays.Where(x => x.IsChecked).Select(x => x.DayOfWeek).ToList();
            settings.AppSettings.StartOfWeek     = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), StartOfWeek, true);
            settings.AppSettings.DefaultTimers   = DefaultTimers.Split(',').SelectMany(x => x.Split(' ')).Where(x => !string.IsNullOrWhiteSpace(x)).ToList();

            if (settings.AppSettings.UsageTracking != AllowTracking)
            {
                settings.AppSettings.UsageTracking = AllowTracking;
                if (!AllowTracking)
                {
                    TrackingOptOut = true;
                }
            }

            //UI Settings
            settings.UiSettings.Theme  = Theme.Name;
            settings.UiSettings.Accent = Accent.Name;
            if (versionControl.IsAutomatedDeploy)
            {
                if (StartOnBoot)
                {
                    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "Gallifrey", $"{versionControl.AppName}.appref-ms");
                    registryKey.SetValue(versionControl.AppName, path);
                }
                else
                {
                    registryKey.DeleteValue(versionControl.AppName, false);
                }
            }
            settings.UiSettings.TopMostOnFlyoutOpen = TopMostOnFlyoutOpen;

            //Jira Settings
            if (settings.JiraConnectionSettings.JiraUrl != JiraUrl ||
                settings.JiraConnectionSettings.JiraUsername != JiraUsername ||
                settings.JiraConnectionSettings.JiraPassword != JiraPassword ||
                settings.JiraConnectionSettings.UseTempo != UseTempo)
            {
                JiraSettingsChanged = true;
            }
            else if (string.IsNullOrWhiteSpace(JiraUrl) || string.IsNullOrWhiteSpace(JiraUsername) || string.IsNullOrWhiteSpace(JiraPassword))
            {
                JiraSettingsChanged = true;
            }

            settings.JiraConnectionSettings.JiraUrl      = JiraUrl;
            settings.JiraConnectionSettings.JiraUsername = JiraUsername;
            settings.JiraConnectionSettings.JiraPassword = JiraPassword;
            settings.JiraConnectionSettings.UseTempo     = UseTempo;

            //Export Settings
            settings.ExportSettings.ExportPrompt.OnAddIdle         = ExportPrompts.First(x => x.Key == "Locked").IsChecked&& !TrackingOnly;
            settings.ExportSettings.ExportPrompt.OnManualAdjust    = ExportPrompts.First(x => x.Key == "Manual").IsChecked&& !TrackingOnly;
            settings.ExportSettings.ExportPrompt.OnStop            = ExportPrompts.First(x => x.Key == "Stop").IsChecked&& !TrackingOnly;
            settings.ExportSettings.ExportPrompt.OnCreatePreloaded = ExportPrompts.First(x => x.Key == "Pre").IsChecked&& !TrackingOnly;
            settings.ExportSettings.ExportPromptAll       = ExportAll;
            settings.ExportSettings.DefaultRemainingValue = SelectedRemainingAdjustmentValue.Remaining;
            settings.ExportSettings.ExportCommentPrefix   = CommentPrefix;
            settings.ExportSettings.EmptyExportComment    = DefaultComment;
            settings.ExportSettings.TrackingOnly          = TrackingOnly;
        }