Beispiel #1
0
 public GrowlController(IProjectMonitor monitor, GrowlConfiguration configuration)
 {
     this.configuration = configuration;
     this.monitor       = monitor;
     this.InitializeLibrary();
     this.InitializeGrowlInstance();
 }
        private void BindNotificationLevelCombo(GrowlConfiguration configuration)
        {
            comboMinNotificationLevel.Items.AddRange(
                new object[] {
                ErrorLevel.Error.NotifyInfo,
                ErrorLevel.Warning.NotifyInfo,
                ErrorLevel.Info.NotifyInfo
            }
                );

            for (int i = 0; i < comboMinNotificationLevel.Items.Count; ++i)
            {
                if (((ToolTipIcon)comboMinNotificationLevel.Items[i]) == configuration.MinimumNotificationLevel)
                {
                    comboMinNotificationLevel.SelectedIndex = i;
                }
            }
        }
        public void BindGrowlControls(GrowlConfiguration configuration)
        {
            checkBoxEnabled.Checked = configuration.Enabled;
            textBoxPassword.Text    = configuration.Password;

            if (!string.IsNullOrEmpty(configuration.Hostname))
            {
                checkBoxRemoteGrowl.Checked = true;
                textBoxHostname.Text        = configuration.Hostname;
                textBoxPort.Text            = configuration.Port.ToString();
            }
            else
            {
                checkBoxRemoteGrowl.Checked = false;
            }
            BindNotificationLevelCombo(configuration);
            EnableControls();
        }
Beispiel #4
0
        public void SetUp()
        {
            mockProjectMonitor = new Mock <IProjectMonitor>(MockBehavior.Strict);
            projectMonitor     = (IProjectMonitor)mockProjectMonitor.Object;

            mockConfiguration = new Mock <ICCTrayMultiConfiguration>();
            configuration     = (ICCTrayMultiConfiguration)mockConfiguration.Object;

            ISingleServerMonitor[] serverMonitors = new ISingleServerMonitor[0];
            mockConfiguration.Setup(_configuration => _configuration.GetServerMonitors()).Returns(serverMonitors);
            mockConfiguration.Setup(_configuration => _configuration.GetProjectStatusMonitors(It.IsAny <ISingleServerMonitor[]>())).Returns(new IProjectMonitor[0]);
            mockConfiguration.SetupGet(_configuration => _configuration.Icons).Returns(new Icons());
            mockConfiguration.SetupGet(_configuration => _configuration.FixUserName).Returns("John");
            GrowlConfiguration growlConfig = new GrowlConfiguration();

            mockConfiguration.SetupGet(_configuration => _configuration.Growl).Returns(growlConfig);

            eventCount = 0;

            controller = new MainFormController(configuration, null, null);
        }
Beispiel #5
0
        public void SetUp()
        {
            mockProjectMonitor        = new DynamicMock(typeof(IProjectMonitor));
            mockProjectMonitor.Strict = true;
            projectMonitor            = (IProjectMonitor)mockProjectMonitor.MockInstance;

            mockConfiguration = new DynamicMock(typeof(ICCTrayMultiConfiguration));
            configuration     = (ICCTrayMultiConfiguration)mockConfiguration.MockInstance;

            ISingleServerMonitor[] serverMonitors = new ISingleServerMonitor[0];
            mockConfiguration.SetupResult("GetServerMonitors", serverMonitors);
            mockConfiguration.SetupResult("GetProjectStatusMonitors", new IProjectMonitor[0], typeof(ISingleServerMonitor[]));
            mockConfiguration.SetupResult("Icons", new Icons());
            mockConfiguration.SetupResult("FixUserName", "John");
            GrowlConfiguration growlConfig = new GrowlConfiguration();

            mockConfiguration.SetupResult("Growl", growlConfig);

            eventCount = 0;

            controller = new MainFormController(configuration, null, null);
        }
        public void PersistGrowlTabSettings(GrowlConfiguration configuration)
        {
            configuration.Enabled  = checkBoxEnabled.Checked;
            configuration.Password = textBoxPassword.Text;
            if (comboMinNotificationLevel.SelectedIndex > -1 && comboMinNotificationLevel.SelectedIndex < comboMinNotificationLevel.Items.Count)
            {
                configuration.MinimumNotificationLevel = (ToolTipIcon)comboMinNotificationLevel.Items[comboMinNotificationLevel.SelectedIndex];
            }
            else
            {
                configuration.MinimumNotificationLevel = ToolTipIcon.None;
            }

            if (checkBoxRemoteGrowl.Checked)
            {
                configuration.Hostname = textBoxHostname.Text;
                configuration.Port     = int.Parse(textBoxPort.Text);
            }
            else
            {
                configuration.Hostname = string.Empty;
            }
        }