internal GitDataUpdater( IMergeRequestCache mergeRequestCache, IDiscussionCache discussionCache, ISynchronizeInvoke synchronizeInvoke, ILocalCommitStorageFactory gitFactory, int autoUpdatePeriodMs, MergeRequestFilter mergeRequestFilter, bool isInitialUpdateNeeded) : base(mergeRequestCache, discussionCache, synchronizeInvoke, gitFactory) { if (autoUpdatePeriodMs < 1) { throw new ArgumentException("Bad auto-update period specified"); } _mergeRequestFilter = mergeRequestFilter; _timer = new System.Timers.Timer { Interval = autoUpdatePeriodMs }; _timer.Elapsed += onTimer; _timer.SynchronizingObject = synchronizeInvoke; _timer.Start(); if (isInitialUpdateNeeded) { scheduleAllProjectsUpdate(); } }
public void When_MergeRequestIsComplete_Then_RedirectToConfirmationScreen() { _mergeRequest = _autoFixture.Build <MergeRequest>() .With(r => r.Completed, true).Create(); SetupMockServices(_mergeRequest); var actionFilter = new MergeRequestFilter(); var actionContext = new ActionContext(_mockHttpContext.Object, new RouteData(), new ActionDescriptor(), new ModelStateDictionary()); var actionExecutingContext = new ActionExecutingContext(actionContext, new List <IFilterMetadata>(), new Dictionary <string, object>(), controller: null); actionFilter.OnActionExecuting(actionExecutingContext); var result = actionExecutingContext.Result as RedirectToActionResult; result.ActionName.Should().Be("MergeComplete"); }
internal EventFilter(UserDefinedSettings settings, DataCache dataCache, MergeRequestFilter mergeRequestFilter) { _settings = settings; _dataCache = dataCache; _dataCache.Disconnected += onDataCacheDisconnected; _dataCache.Connected += onDataCacheConnected; _mergeRequestFilter = mergeRequestFilter; }
private void createMessageFilterFromSettings() { _mergeRequestFilter = new MergeRequestFilter(createMergeRequestFilterState()); _mergeRequestFilter.FilterChanged += () => updateMergeRequestList(EDataCacheType.Live); }
internal void SetFilter(MergeRequestFilter filter) { _mergeRequestFilter = filter; }
private void loadConfiguration() { _loadingConfiguration = true; Trace.TraceInformation("[MainForm] Loading configuration"); Program.Settings.PropertyChanged += onSettingsPropertyChanged; Debug.Assert(Program.Settings.KnownHosts.Count() == Program.Settings.KnownAccessTokens.Count()); // Remove all items except header for (int iListViewItem = 1; iListViewItem < listViewKnownHosts.Items.Count; ++iListViewItem) { listViewKnownHosts.Items.RemoveAt(iListViewItem); } List <string> newKnownHosts = new List <string>(); List <string> newAccessTokens = new List <string>(); for (int iKnownHost = 0; iKnownHost < Program.Settings.KnownHosts.Count(); ++iKnownHost) { // Upgrade from old versions which did not have prefix string host = StringUtils.GetHostWithPrefix(Program.Settings.KnownHosts[iKnownHost]); string accessToken = Program.Settings.KnownAccessTokens.Length > iKnownHost ? Program.Settings.KnownAccessTokens[iKnownHost] : String.Empty; if (addKnownHost(host, accessToken)) { newKnownHosts.Add(host); newAccessTokens.Add(accessToken); } } Program.Settings.KnownHosts = newKnownHosts.ToArray(); Program.Settings.KnownAccessTokens = newAccessTokens.ToArray(); if (Program.Settings.ColorSchemeFileName == String.Empty) { // Upgrade from old versions which did not have a separate file for Default color scheme Program.Settings.ColorSchemeFileName = getDefaultColorSchemeFileName(); } textBoxStorageFolder.Text = Program.Settings.LocalGitFolder; checkBoxDisplayFilter.Checked = Program.Settings.DisplayFilterEnabled; textBoxDisplayFilter.Text = Program.Settings.DisplayFilter; checkBoxMinimizeOnClose.Checked = Program.Settings.MinimizeOnClose; checkBoxRunWhenWindowsStarts.Checked = Program.Settings.RunWhenWindowsStarts; applyAutostartSetting(Program.Settings.RunWhenWindowsStarts); checkBoxDisableSplitterRestrictions.Checked = Program.Settings.DisableSplitterRestrictions; checkBoxNewDiscussionIsTopMostForm.Checked = Program.Settings.NewDiscussionIsTopMostForm; var showWarningsOnFileMismatchMode = ConfigurationHelper.GetShowWarningsOnFileMismatchMode(Program.Settings); switch (showWarningsOnFileMismatchMode) { case ConfigurationHelper.ShowWarningsOnFileMismatchMode.Always: radioButtonShowWarningsAlways.Checked = true; break; case ConfigurationHelper.ShowWarningsOnFileMismatchMode.Never: radioButtonShowWarningsNever.Checked = true; break; case ConfigurationHelper.ShowWarningsOnFileMismatchMode.UntilUserIgnoresFile: radioButtonShowWarningsOnce.Checked = true; break; } RevisionType defaultRevisionType = ConfigurationHelper.GetDefaultRevisionType(Program.Settings); switch (defaultRevisionType) { case RevisionType.Commit: radioButtonCommits.Checked = true; break; case RevisionType.Version: radioButtonVersions.Checked = true; break; } _mergeRequestFilter = new MergeRequestFilter(createMergeRequestFilterState()); _mergeRequestFilter.FilterChanged += updateVisibleMergeRequests; checkBoxShowNewMergeRequests.Checked = Program.Settings.Notifications_NewMergeRequests; checkBoxShowMergedMergeRequests.Checked = Program.Settings.Notifications_MergedMergeRequests; checkBoxShowUpdatedMergeRequests.Checked = Program.Settings.Notifications_UpdatedMergeRequests; checkBoxShowResolvedAll.Checked = Program.Settings.Notifications_AllThreadsResolved; checkBoxShowOnMention.Checked = Program.Settings.Notifications_OnMention; checkBoxShowKeywords.Checked = Program.Settings.Notifications_Keywords; checkBoxShowMyActivity.Checked = Program.Settings.Notifications_MyActivity; checkBoxShowServiceNotifications.Checked = Program.Settings.Notifications_Service; if (ConfigurationHelper.IsProjectBasedWorkflowSelected(Program.Settings)) { radioButtonSelectByProjects.Checked = true; } else { radioButtonSelectByUsernames.Checked = true; } LocalCommitStorageType type = ConfigurationHelper.GetPreferredStorageType(Program.Settings); switch (type) { case LocalCommitStorageType.FileStorage: radioButtonDontUseGit.Checked = true; break; case LocalCommitStorageType.FullGitRepository: radioButtonUseGitFullClone.Checked = true; break; case LocalCommitStorageType.ShallowGitRepository: radioButtonUseGitShallowClone.Checked = true; break; } if (comboBoxDCDepth.Items.Contains(Program.Settings.DiffContextDepth)) { comboBoxDCDepth.Text = Program.Settings.DiffContextDepth; } else { comboBoxDCDepth.SelectedIndex = 0; } loadColumnWidths(listViewMergeRequests, Program.Settings.ListViewMergeRequestsColumnWidths); loadColumnWidths(listViewFoundMergeRequests, Program.Settings.ListViewFoundMergeRequestsColumnWidths); loadColumnIndices(listViewMergeRequests, Program.Settings.ListViewMergeRequestsDisplayIndices, x => Program.Settings.ListViewMergeRequestsDisplayIndices = x); loadColumnIndices(listViewFoundMergeRequests, Program.Settings.ListViewFoundMergeRequestsDisplayIndices, x => Program.Settings.ListViewFoundMergeRequestsDisplayIndices = x); WinFormsHelpers.FillComboBox(comboBoxFonts, Constants.MainWindowFontSizeChoices, Program.Settings.MainWindowFontSizeName); applyFont(Program.Settings.MainWindowFontSizeName); WinFormsHelpers.FillComboBox(comboBoxThemes, Constants.ThemeNames, Program.Settings.VisualThemeName); applyTheme(Program.Settings.VisualThemeName); Trace.TraceInformation("[MainForm] Configuration loaded"); _loadingConfiguration = false; }