/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { // DO NOT REORDER variable instantiation unless you know what you are doing!!! InitializeComponent(); // Settings should come first Settings.Instance = Settings.Load(Utilities.GetAppDataPath() + "Settings.xml"); if (Settings.Instance == null) { SettingsWindow win = new SettingsWindow(); Settings.Instance = new Settings(); win.ShowDialog(); } // File System must be set after settings FileSystem = new Common.FileSystem.IO(Settings.Instance.StorageLocation); // Logger can be started after FileSystem Logger = new Common.Logger(Utilities.GetAppDataPath()); // CouchDB can be instantiated after both FileSystem and Logger _couchdb = new Common.CouchDB.Database(Settings.Instance.CouchDatabaseName, new Common.CouchDB.Server(Settings.Instance.CouchServerIp, Settings.Instance.CouchServerPort)); Common.ErrorManager.UpdateUI actErrorUpdateUI = ErrorUpdateUI; ErrorManager = new Common.ErrorManager(actErrorUpdateUI); _statusBarItemGuid = Guid.Empty; _workMaster = new Master(ErrorManager, FileSystem, _couchdb); IdTranslation = new Dictionary <Guid, Guid>(); _fsWatcher = new FileSystemWatcher(Settings.Instance.StorageLocation); _fsWatcher.IncludeSubdirectories = true; _fsWatcher.NotifyFilter = NotifyFilters.LastWrite; _fsWatcher.Changed += new FileSystemEventHandler(FS_Changed); _fsWatcher.EnableRaisingEvents = true; _addedFileMappings = new Dictionary <string, Guid>(); this.Loaded += new RoutedEventHandler(MainWindow_Loaded); ResourceTree.OnRelease += new ResourceTreeView.EventDelegate(ResourceTree_OnRelease); ResourceTree.OnCancel += new ResourceTreeView.EventDelegate(ResourceTree_OnCancel); ResourceTree.OnItemSelect += new ResourceTreeView.EventDelegate(ResourceTree_OnItemSelect); ResourceTree.OnReload += new ResourceTreeView.EventDelegate(ResourceTree_OnReload); ResourceTree.OnStatusUpdate += new ResourceTreeView.StatusUpdateDelegate(ResourceTree_OnStatusUpdate); ResourceTree.RegisterStatusBarItem(SBItem); }
/// <summary> /// Handles the Click event of the BtnSettings control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void BtnSettings_Click(object sender, RoutedEventArgs e) { SettingsWindow win = new SettingsWindow(); win.ShowDialog(); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { // DO NOT REORDER variable instantiation unless you know what you are doing!!! InitializeComponent(); // Settings should come first Settings.Instance = Settings.Load(Utilities.GetAppDataPath() + "Settings.xml"); if (Settings.Instance == null) { SettingsWindow win = new SettingsWindow(); Settings.Instance = new Settings(); win.ShowDialog(); } // File System must be set after settings FileSystem = new Common.FileSystem.IO(Settings.Instance.StorageLocation); // Logger can be started after FileSystem Logger = new Common.Logger(Utilities.GetAppDataPath()); // CouchDB can be instantiated after both FileSystem and Logger _couchdb = new Common.CouchDB.Database(Settings.Instance.CouchDatabaseName, new Common.CouchDB.Server(Settings.Instance.CouchServerIp, Settings.Instance.CouchServerPort)); Common.ErrorManager.UpdateUI actErrorUpdateUI = ErrorUpdateUI; ErrorManager = new Common.ErrorManager(actErrorUpdateUI); _statusBarItemGuid = Guid.Empty; _workMaster = new Master(ErrorManager, FileSystem, _couchdb); IdTranslation = new Dictionary<Guid, Guid>(); _fsWatcher = new FileSystemWatcher(Settings.Instance.StorageLocation); _fsWatcher.IncludeSubdirectories = true; _fsWatcher.NotifyFilter = NotifyFilters.LastWrite; _fsWatcher.Changed += new FileSystemEventHandler(FS_Changed); _fsWatcher.EnableRaisingEvents = true; _addedFileMappings = new Dictionary<string, Guid>(); this.Loaded += new RoutedEventHandler(MainWindow_Loaded); ResourceTree.OnRelease += new ResourceTreeView.EventDelegate(ResourceTree_OnRelease); ResourceTree.OnCancel += new ResourceTreeView.EventDelegate(ResourceTree_OnCancel); ResourceTree.OnItemSelect += new ResourceTreeView.EventDelegate(ResourceTree_OnItemSelect); ResourceTree.OnReload += new ResourceTreeView.EventDelegate(ResourceTree_OnReload); ResourceTree.OnStatusUpdate += new ResourceTreeView.StatusUpdateDelegate(ResourceTree_OnStatusUpdate); ResourceTree.RegisterStatusBarItem(SBItem); }