public IndexDatabase(string databaseDirectory, IncrementalIdentityStore identityStore) { this.databaseDirectory = databaseDirectory ?? throw new ArgumentNullException(nameof(databaseDirectory)); this.identityStore = identityStore ?? throw new ArgumentNullException(nameof(identityStore)); insertLock = new object(); Init(); }
public ShellForm(TextFileProcessor textFileProcessor, FolderManager folderManager, IncrementalIdentityStore identityStore) { InitializeComponent(); this.identityStore = identityStore; this.folderManager = folderManager; this.textFileProcessor = textFileProcessor; Load += (s, e) => { searchBar_middle_image.Width = searchBar_right_image.Left - searchBar_middle_image.Left + 3; urlNsearchTextbox.Width = searchBar_middle_image.Width - 3; }; Resize += (s, e) => { searchBar_middle_image.Width = searchBar_right_image.Left - searchBar_middle_image.Left + 3; urlNsearchTextbox.Width = searchBar_middle_image.Width - 3; }; homeButton.MouseEnter += (s, e) => homeButton.BackgroundImage = Properties.Resources.Home_Enter; homeButton.MouseLeave += (s, e) => homeButton.BackgroundImage = Properties.Resources.Home_Leave; homeButton.MouseDown += (s, e) => homeButton.BackgroundImage = Properties.Resources.Home_Press; homeButton.MouseUp += (s, e) => homeButton.BackgroundImage = Properties.Resources.Home_Leave; goButton.MouseEnter += (s, e) => goButton.BackgroundImage = Properties.Resources.Search_Enter; goButton.MouseLeave += (s, e) => goButton.BackgroundImage = Properties.Resources.Search_Leave; goButton.MouseDown += (s, e) => goButton.BackgroundImage = Properties.Resources.Search_Press; goButton.MouseUp += (s, e) => goButton.BackgroundImage = Properties.Resources.Search_Leave; }
private async void SplashForm_Load(object sender, EventArgs e) { a = 0; frameNumber = 0; speed = MaxWaveSpeed; speedDelta = -1; messageIndex = 0; messageStep = 0; requestNextFrame = true; animationTimer = new Timer(); animationTimer.Tick += AnimationTimer_Tick; animationTimer.Interval = 100; animationTimer.Start(); messageTimer = new System.Threading.Timer(_ => { messageStep++; if (messageStep == MaxMessageStep + 1) { messageStep = 0; messageIndex++; if (messageIndex == messages.Length) // disable the timer { messageIndex--; messageTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); } } }, null, 0, MinSplashTime / (messages.Length * MaxMessageStep)); try { initTask = Task.Run(() => { var dataDirectory = Path.Combine(Environment.CurrentDirectory, "datastore"); identityStore = new IncrementalIdentityStore(dataDirectory); folderManager = new FolderManager(dataDirectory, identityStore); textFileProcessor = new TextFileProcessor(dataDirectory, identityStore); folderManager.TextFileCreated = (arg) => textFileProcessor.TextFileCreated(arg.FileId, arg.FilePath, arg.OnCompleted); folderManager.TextFileChanged = (arg) => textFileProcessor.TextFileChanged(arg.FileId, arg.FilePath, arg.OnCompleted); folderManager.TextFileRemoved = (arg) => textFileProcessor.TextFilesRemoved(new[] { arg.FileId }, arg.OnCompleted); folderManager.MultipleTextFilesDeleted = (arg) => textFileProcessor.TextFilesRemoved(arg.FileIds, arg.OnCompleted); textFileProcessor.StartRequestProcessingLoop(); folderManager.StartWatching(); }); await Task.WhenAll(Task.Delay(MinSplashTime), initTask); var shellForm = new ShellForm(textFileProcessor, folderManager, identityStore); StartShellForm(shellForm); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } finally { messageTimer?.Dispose(); animationTimer?.Dispose(); path?.Dispose(); brush?.Dispose(); } }
public FolderManager(string databaseDirectory, IncrementalIdentityStore identityStore) { fileDatabase = new FileDatabase(databaseDirectory, identityStore); fileWatchers = new ConcurrentDictionary <string, FileSystemWatcher>(StringComparer.OrdinalIgnoreCase); }