Exemple #1
0
        private DoWorkResults DoWork(TraySettings traySettings)
        {
            var           mainViewModels = new List <MainViewModel>();
            List <Server> servers        = traySettings.Servers.Where(server => server.BuildPlans.Count > 0).ToList();

            foreach (var server in servers)
            {
                try
                {
                    var bambooService = new BambooService(new Uri(server.Address), server.Username, server.PlaintextPassword);
                    foreach (var buildPlan in server.BuildPlans)
                    {
                        var planDetail = bambooService.GetPlanDetail(buildPlan.Key);
                        planDetail.Results = bambooService.GetPlanResults(buildPlan.Key);

                        var resultDetail = planDetail.Results.FirstOrDefault();
                        if (resultDetail != null)
                        {
                            resultDetail.Detail = bambooService.GetResultDetail(resultDetail.Key);
                        }

                        mainViewModels.Add(MainViewModelBuilder.Build(planDetail, server));
                    }
                }
                catch (BambooRequestException e)
                {
                    return(new DoWorkResults(e));
                }
            }

            return(new DoWorkResults(mainViewModels));
        }
        private async void StartLogic(TraySettings settings)
        {
            //Initializing Chroma SDK
            IChroma chromaInstance = await ColoreProvider.CreateNativeAsync();

            AppInfo appInfo = new AppInfo(
                "Ambilight for Razer devices",
                "Shows an ambilight effect on your Razer Chroma devices",
                "Nico Jeske",
                "*****@*****.**",
                new[]
            {
                ApiDeviceType.Headset,
                ApiDeviceType.Keyboard,
                ApiDeviceType.Keypad,
                ApiDeviceType.Mouse,
                ApiDeviceType.Mousepad,
                ApiDeviceType.ChromaLink
            },
                Category.Application);
            await chromaInstance.InitializeAsync(appInfo);

            _keyboardLogic = new KeyboardLogic(settings, chromaInstance);
            _mousePadLogic = new MousePadLogic(settings, chromaInstance);
            _mouseLogic    = new MouseLogic(settings, chromaInstance);
            _linkLogic     = new LinkLogic(settings, chromaInstance);
            _headsetLogic  = new HeadsetLogic(settings, chromaInstance);
            _keypadLogic   = new KeypadLogic(settings, chromaInstance);

            DesktopDuplicatorReader reader = new DesktopDuplicatorReader(this, settings);
        }
Exemple #3
0
 private void Minimize()
 {
     TraySettings.WindowVisible = false;
     TraySettings.Save(TraySettingsType.TrayWindowVisibility);
     Hide();
     Opacity       = 0;
     ShowInTaskbar = false;
     AdjustTrayMenu();
 }
Exemple #4
0
 private void Restore()
 {
     TraySettings.WindowVisible = true;
     TraySettings.Save(TraySettingsType.TrayWindowVisibility);
     Opacity       = 1;
     ShowInTaskbar = true;
     Show();
     WindowState = FormWindowState.Normal;
     Refresh();
     AdjustTrayMenu();
 }
Exemple #5
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            TraySettings.Load();
            if (TraySettings.WindowVisible)
            {
                Restore();
            }
            else
            {
                Minimize();
            }
            toolStripMenuItemOptionsStartWithWindows.Checked = TraySettings.StartWithWindows;
            SetStartWithWindows(TraySettings.StartWithWindows);
// ReSharper disable AssignNullToNotNullAttribute
            _statusRunning = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("UnpakkDaemonTray.Resources.Status-Running-16.png"));
            _statusPaused  = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("UnpakkDaemonTray.Resources.Status-Paused-16.png"));
            _statusStopped = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("UnpakkDaemonTray.Resources.Status-Stopped-16.png"));
            _record        = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("UnpakkDaemonTray.Resources.Record-48.png"));
            _recordRed     = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("UnpakkDaemonTray.Resources.Record-Red-48.png"));
            _subRecord     = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("UnpakkDaemonTray.Resources.SubRecord-48.png"));
            _subRecordRed  = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("UnpakkDaemonTray.Resources.SubRecord-Red-48.png"));
// ReSharper restore AssignNullToNotNullAttribute
            pictureBoxRecord.Image    = _record;
            pictureBoxSubRecord.Image = _subRecord;
            FileLogger.LogEntryRead  += FileLogger_LogEntryRead;
            StatusChangedHandler statusChangedHandler = new StatusChangedHandler();

            statusChangedHandler.ProgressChanged    += StatusChangedHandler_ProgressChanged;
            statusChangedHandler.SubProgressChanged += StatusChangedHandler_SubProgressChanged;
            statusChangedHandler.RecordAdded        += StatusChangedHandler_RecordAdded;
            statusChangedHandler.SubRecordAdded     += StatusChangedHandler_SubRecordAdded;
            statusChangedHandler.LogEntryAdded      += StatusChangedHandler_LogEntryAdded;
            ObjectPool.StatusServiceHandler          = new StatusServiceHandler(statusChangedHandler);
            ObjectPool.StatusServiceHandler.Start();
            ObjectPool.LogFilterDaysBack     = 0;
            ObjectPool.LogFilterLeastLogType = LogType.Flow;
            SetupLogFilter();
            EngineSettings.Load();
            LoadRecords();
            LoadLog();
        }
        public TraySettings CreateCopy()
        {
            TraySettings original = TraySettings;

            var copy = new TraySettings
            {
                PollTime          = original.PollTime,
                AnimatedBuildIcon = original.AnimatedBuildIcon,

                EnableBalloonNotifications = original.EnableBalloonNotifications,
                BalloonToolTipTimeOut      = original.BalloonToolTipTimeOut,
                BalloonNotifications       = new List <NotificationType>(original.BalloonNotifications),

                EnableSpeechNotifications = original.EnableSpeechNotifications,
                SpeechNotifications       = new List <NotificationType>(original.SpeechNotifications),
                SpeechNotificationVoice   = original.SpeechNotificationVoice.ToString(),

                DisplayParameters = original.DisplayParameters?.Clone() as byte[],
            };

            foreach (var originalServer in original.Servers)
            {
                var newServer = new Server()
                {
                    Id       = originalServer.Id,
                    Address  = originalServer.Address,
                    Name     = originalServer.Name,
                    Username = originalServer.Username,
                    Password = originalServer.Password
                };

                newServer.BuildPlans.AddRange(originalServer.BuildPlans.Select(p => new BuildPlan()
                {
                    Key = p.Key
                }));

                copy.Servers.Add(newServer);
            }

            return(copy);
        }
        public SettingsService(string settingsPath)
        {
            _settingsPath = settingsPath;

            if (!File.Exists(settingsPath))
            {
                TraySettings = new TraySettings();
            }
            else
            {
                var serializer = new XmlSerializer(typeof(TraySettings));
                using (var streamReader = new StreamReader(settingsPath))
                    TraySettings = (TraySettings)serializer.Deserialize(streamReader);
            }

            if (TraySettings.Version == 0)
            {
                TraySettings.Version = 1;
                TraySettings.BalloonNotifications = Enum.GetValues(typeof(NotificationType)).Cast <NotificationType>().Where(e => e != NotificationType.Succesfull).ToList();
                TraySettings.SpeechNotifications  = Enum.GetValues(typeof(NotificationType)).Cast <NotificationType>().Where(e => e != NotificationType.Succesfull).ToList();
                SaveTraySettings();
            }
        }
Exemple #8
0
 public MousePadLogic(TraySettings settings)
 {
     this.settings = settings;
 }
        public TraySettings SetTraySettings()
        {
            traySettings = new TraySettings();


            traySettings.IsUseRequesetedTraySet = useRequestedTray_choiceComboControl.onOff_CheckBox.Checked;
            if (traySettings.IsUseRequesetedTraySet)
            {
                traySettings.UseRequesetedTray = useRequestedTray_choiceComboControl.choice_Combo.SelectedValue.ToString().Equals("WhenAvailable") ? false : true;
            }

            traySettings.IsManualFeedPromptSet = manualFeedPrompt_choiceComboControl.onOff_CheckBox.Checked;
            if (traySettings.IsManualFeedPromptSet)
            {
                traySettings.ManualFeedPrompt = manualFeedPrompt_choiceComboControl.choice_Combo.SelectedValue.ToString().Equals("PromptOnMismatch") ? false : true;
            }

            traySettings.IsSizeTypePromptSet = sizeTypePrompt_choiceComboControl.onOff_CheckBox.Checked;
            if (traySettings.IsSizeTypePromptSet)
            {
                traySettings.SizeTypePrompt = sizeTypePrompt_choiceComboControl.choice_Combo.SelectedValue.ToString().Equals("DoNotDisplay") ? false : true;
            }

            traySettings.IsUseAnotherTraySet = useAnotherTray_choiceComboControl.onOff_CheckBox.Checked;
            if (traySettings.IsUseAnotherTraySet)
            {
                traySettings.UseAnotherTray = useAnotherTray_choiceComboControl.choice_Combo.SelectedValue.ToString().Equals("DoNotAllow") ? false : true;
            }

            traySettings.IsAlternativeLetterheadModeSet = alternativeLetterheadMode_choiceComboControl.onOff_CheckBox.Checked;
            if (traySettings.IsAlternativeLetterheadModeSet)
            {
                traySettings.AlternativeLetterheadMode = alternativeLetterheadMode_choiceComboControl.choice_Combo.SelectedValue.ToString().Equals("On") ? false : true;
            }

            traySettings.IsDuplexBlankPagesSet = duplexBlankPages_choiceComboControl.onOff_CheckBox.Checked;
            if (traySettings.IsDuplexBlankPagesSet)
            {
                traySettings.DuplexBlankPages = duplexBlankPages_choiceComboControl.choice_Combo.SelectedValue.ToString().Equals("Always") ? false : true;
            }

            if (imageRotation_choiceComboControl.onOff_CheckBox.Checked)
            {
                traySettings.IsImageRotationSet = true;
                if (imageRotation_choiceComboControl.choice_Combo.SelectedValue.ToString() == "LeftToRight")
                {
                    traySettings.ImageRotation = ImageRoationType.LeftToRight;
                }
                else if (imageRotation_choiceComboControl.choice_Combo.SelectedValue.ToString() == "RightToLeft")
                {
                    traySettings.ImageRotation = ImageRoationType.RightToLeft;
                }
                else
                {
                    traySettings.ImageRotation = ImageRoationType.Alternate;
                }
            }
            else
            {
                traySettings.IsImageRotationSet = false;
            }

            traySettings.IsOverrideA4LetterSet = overrideA4Letter_choiceComboControl.onOff_CheckBox.Checked;
            if (traySettings.IsOverrideA4LetterSet)
            {
                traySettings.OverrideA4Letter = overrideA4Letter_choiceComboControl.choice_Combo.SelectedValue.ToString().Equals("Yes") ? false : true;
            }

            return(traySettings);
        }
Exemple #10
0
 public MousePadLogic(TraySettings settings, IChroma chromaInstance)
 {
     this._settings = settings;
     this._chroma   = chromaInstance;
 }
Exemple #11
0
 private void ToggleStartTrayWithWindows()
 {
     TraySettings.StartWithWindows = !TraySettings.StartWithWindows;
     TraySettings.Save(TraySettingsType.TrayStartupWithWindows);
     SetStartWithWindows(TraySettings.StartWithWindows);
 }
Exemple #12
0
        public LogicManager(TraySettings settings)
        {
            this.settings = settings ?? throw new ArgumentNullException(nameof(settings));

            this.StartLogic(settings);
        }
Exemple #13
0
 public HeadsetLogic(TraySettings settings, IChroma chroma)
 {
     _settings = settings;
     _chroma   = chroma;
 }
        public bool CheckExecuteStatus(TraySettings traySettings)
        {
            bool checkStatus = traySettings.IsUseRequesetedTraySet || traySettings.IsManualFeedPromptSet || traySettings.IsSizeTypePromptSet || traySettings.IsUseAnotherTraySet || traySettings.IsAlternativeLetterheadModeSet || traySettings.IsDuplexBlankPagesSet || traySettings.IsImageRotationSet || traySettings.IsOverrideA4LetterSet;

            return(checkStatus);
        }
        private void PopulateGeneralSettings()
        {
            TraySettings traySettings = _settingsService.TraySettings;

            numericPollTime.Value         = ToSeconds(traySettings.PollTime, (int)numericPollTime.Minimum, (int)numericPollTime.Maximum);
            numericPollTime.ValueChanged += (sender, args) =>
            {
                traySettings.PollTime = ToMilliseconds((int)numericPollTime.Value);
                _settingsService.SaveTraySettings();
            };

            checkboxAnimatedBuildIcon.Checked         = traySettings.AnimatedBuildIcon;
            checkboxAnimatedBuildIcon.CheckedChanged += (sender, args) =>
            {
                traySettings.AnimatedBuildIcon = checkboxAnimatedBuildIcon.Checked;
                _settingsService.SaveTraySettings();
            };

            checkboxEnableBalloonNotifications.Checked         = traySettings.EnableBalloonNotifications;
            checkboxEnableBalloonNotifications.CheckedChanged += (sender, args) =>
            {
                traySettings.EnableBalloonNotifications = checkboxEnableBalloonNotifications.Checked;
                _settingsService.SaveTraySettings();
            };

            numericBalloonTooltipTimeout.Value         = ToSeconds(traySettings.BalloonToolTipTimeOut, (int)numericBalloonTooltipTimeout.Minimum, (int)numericBalloonTooltipTimeout.Maximum);
            numericBalloonTooltipTimeout.ValueChanged += (sender, args) =>
            {
                traySettings.BalloonToolTipTimeOut = ToMilliseconds((int)numericBalloonTooltipTimeout.Value);
                _settingsService.SaveTraySettings();
            };

            foreach (var item in Enum.GetValues(typeof(NotificationType)))
            {
                checkBalloonNotifications.Items.Add(item, traySettings.BalloonNotifications.Contains((NotificationType)item));
            }
            checkBalloonNotifications.ItemCheck += (sender, args) =>
            {
                var item = (NotificationType)checkBalloonNotifications.Items[args.Index];
                if (args.NewValue == CheckState.Checked)
                {
                    traySettings.BalloonNotifications.Add(item);
                }
                else
                {
                    traySettings.BalloonNotifications.RemoveAll(i => i == item);
                }
                _settingsService.SaveTraySettings();
            };

            checkboxEnableSpeechNotifications.Checked         = traySettings.EnableSpeechNotifications;
            checkboxEnableSpeechNotifications.CheckedChanged += (sender, args) =>
            {
                traySettings.EnableSpeechNotifications = checkboxEnableSpeechNotifications.Checked;
                _settingsService.SaveTraySettings();
            };

            comboSpeechVoice.Items.Clear();
            var voices = new SpeechController().Voices.ToArray();

            comboSpeechVoice.Items.AddRange(voices);
            comboSpeechVoice.SelectedItem          = string.IsNullOrEmpty(traySettings.SpeechNotificationVoice)? voices.FirstOrDefault(): traySettings.SpeechNotificationVoice;
            comboSpeechVoice.SelectedValueChanged += (sender, args) =>
            {
                traySettings.SpeechNotificationVoice = comboSpeechVoice.SelectedItem?.ToString();
                _settingsService.SaveTraySettings();
            };

            foreach (var item in Enum.GetValues(typeof(NotificationType)))
            {
                checkSpeechNotifications.Items.Add(item, traySettings.SpeechNotifications.Contains((NotificationType)item));
            }
            checkSpeechNotifications.ItemCheck += (sender, args) =>
            {
                var item = (NotificationType)checkSpeechNotifications.Items[args.Index];
                if (args.NewValue == CheckState.Checked)
                {
                    traySettings.SpeechNotifications.Add(item);
                }
                else
                {
                    traySettings.SpeechNotifications.RemoveAll(i => i == item);
                }
                _settingsService.SaveTraySettings();
            };
        }
 public KeyboardLogic(TraySettings settings, IChroma chromaInstance)
 {
     this._settings = settings;
     this._chroma   = chromaInstance;
 }