/// <summary> /// If the user is determined to be a first time user, this function /// generates an initial index. This function blocks until the index /// is generated /// </summary> /// <returns>true means new user found</returns> public bool IsFirstTimeUser() { if (Directory.Exists(Properties.Settings.Instance.IndexPath)) { return(false); } Logger.Instance.LogDebug("First time user. Generating initial index"); m_form = new IndexGeneration(); m_form.Show(); m_fileExplorer = new FileExplorer(PluginManager.Instance.RegisteredFileExtensions); m_fileExplorer.Run(true); m_dlgtProgressHandler = new FileExplorerProgressHandler(m_form.ShowProgress); m_dlgtDoneHandler = new FileExplorerDoneHandler(FirstTimeDone); m_fileExplorer.FileExplorerProgress += m_dlgtProgressHandler; m_fileExplorer.FileExplorerDone += m_dlgtDoneHandler; // lock(m_firstTimeUserLock) // { // Monitor.Wait(m_firstTimeUserLock); // } return(true); }
static void Main() { if (AppIsRunning()) { return; } Logger LOG = Logger.Instance; LOG.LogDebug("Starting OpenDesktop"); FirstTimeUser firstTimeUser = new FirstTimeUser(); bool alreadydone = firstTimeUser.IsFirstTimeUser(); //firstTimeUser = null; LOG.LogDebug("Bringing up Webserver"); WebServer.Instance.Start(); LOG.LogDebug("Displaying NotifyIcon"); TrayIcon trayIcon = new TrayIcon(); MessageBox.Show(WebServer.Instance.LocalAddress); FileExplorer fileExplorer = null; IndexProgressHandler dlgtIndexProgressHandler = null; if (!alreadydone) { fileExplorer = new FileExplorer(PluginManager.Instance.RegisteredFileExtensions); dlgtIndexProgressHandler = new IndexProgressHandler(fileExplorer_IndexProgress); fileExplorer.IndexProgress += dlgtIndexProgressHandler; fileExplorer.Run(false); // Dont be aggressive } Application.Run(); if (!alreadydone) { fileExplorer.IndexProgress -= dlgtIndexProgressHandler; fileExplorer.Stop(); } WebServer.Instance.Stop(); LOG.LogDebug("Exiting OpenDesktop"); Logger.Instance.Dispose(); }
/// <summary> /// If the user is determined to be a first time user, this function /// generates an initial index. This function blocks until the index /// is generated /// </summary> /// <returns>true means new user found</returns> public bool IsFirstTimeUser() { if(Directory.Exists(Properties.Settings.Instance.IndexPath)) return false; Logger.Instance.LogDebug("First time user. Generating initial index"); m_form = new IndexGeneration(); m_form.Show(); m_fileExplorer = new FileExplorer(PluginManager.Instance.RegisteredFileExtensions); m_fileExplorer.Run(true); m_dlgtProgressHandler = new FileExplorerProgressHandler(m_form.ShowProgress); m_dlgtDoneHandler = new FileExplorerDoneHandler(FirstTimeDone); m_fileExplorer.FileExplorerProgress += m_dlgtProgressHandler; m_fileExplorer.FileExplorerDone += m_dlgtDoneHandler; // lock(m_firstTimeUserLock) // { // Monitor.Wait(m_firstTimeUserLock); // } return true; }
static void Main() { if (AppIsRunning()) { return; } Logger LOG = Logger.Instance; LOG.LogDebug("Starting OpenDesktop"); FirstTimeUser firstTimeUser = new FirstTimeUser(); bool alreadydone = firstTimeUser.IsFirstTimeUser(); //firstTimeUser = null; LOG.LogDebug("Bringing up Webserver"); WebServer.Instance.Start(); LOG.LogDebug("Displaying NotifyIcon"); TrayIcon trayIcon = new TrayIcon(); MessageBox.Show(WebServer.Instance.LocalAddress); FileExplorer fileExplorer = null; IndexProgressHandler dlgtIndexProgressHandler = null; if(!alreadydone) { fileExplorer = new FileExplorer(PluginManager.Instance.RegisteredFileExtensions); dlgtIndexProgressHandler = new IndexProgressHandler(fileExplorer_IndexProgress); fileExplorer.IndexProgress += dlgtIndexProgressHandler; fileExplorer.Run(false); // Dont be aggressive } Application.Run(); if(!alreadydone) { fileExplorer.IndexProgress -= dlgtIndexProgressHandler; fileExplorer.Stop(); } WebServer.Instance.Stop(); LOG.LogDebug("Exiting OpenDesktop"); Logger.Instance.Dispose(); }