Example #1
0
        public UserWindow(int signedInUserID)
        {
            InitializeComponent();
            UserWindowObject = this;

            // Initialize User Model
            signedInUser = new UserModel(signedInUserID);

            // Initialize DataContext with signedInUser Model
            DataContext = signedInUser;

            // Initialize UserWindowPages Objects
            HomePageObject               = new HomePage();
            ChallengesPageObject         = new ChallengesPage();
            PlansPageObject              = new PlansPage();
            CaloriesCalculatorPageObject = new CaloriesCalculatorPage();
            SettingsPageObject           = new SettingsPage();

            // Initialize Listbox Selected Index
            UserWindowPagesListBox.SelectedIndex = 0;

            // Intialize MessagesQueue and Assign it to MessagesSnackbar's MessageQueue
            var MessagesQueue = new SnackbarMessageQueue(System.TimeSpan.FromMilliseconds(2000));

            MessagesSnackbar.MessageQueue = MessagesQueue;
        }
        /// <summary>
        ///     Initializes a new instance of the MainWindowViewModel class.
        /// </summary>
        public MainWindowViewModel(IProviderService providerService, ILinkParser linkParser,
                                   IWindowFactory windowFactory,
                                   IViewModelFactory viewModelFactory, IDbContext dbContext, Logger logger)
        {
            _dbContext        = dbContext;
            _logger           = logger;
            _linkParser       = linkParser;
            _windowFactory    = windowFactory;
            Instance          = this;
            ProviderService   = providerService;
            _viewModelFactory = viewModelFactory;
            SnackbarQueue     = new SnackbarMessageQueue();
            StartStopCommand  = new ActionCommand(StartStop);
            RefreshCommand    = new ActionCommand(() => ProviderService.Timer = 5);
            OpenViewerCommand = new ActionCommand(ParseLink);

            ProviderService.Run().ConfigureAwait(false);

            //test PEPE
            //WebParser.GetRssFeedAsync("https://yomanga.co/reader/feeds/rss").ConfigureAwait(false);
            //WebParser.GetRssFeedAsync("https://gameofscanlation.moe/projects/trinity-wonder/index.rss").ConfigureAwait(false);
            //WebParser.GetRssFeedAsync("http://bato.to/myfollows_rss?secret=dd5831f7430c7ed7ea7055db4fe7b7ad&l=English").ConfigureAwait(false);
            //WebParser.GetRssFeedAsync("http://read.tomochan.today/rss").ConfigureAwait(false);
            //WebParser.GetRssFeedAsync("http://www.webtoons.com/en/fantasy/tower-of-god/rss?title_no=95").ConfigureAwait(false);
            _logger.Log.Info("starting");
            //SnackbarQueue.Enqueue("Starting...", true);
        }
Example #3
0
        public ClientViewModel()
        {
            fileManagerService = new FileWindowService();

            Clients = new ObservableCollection <ClientInfo>();

            ConnectedMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(5000));

            OpenFileManagerCommand = new RelayCommand <ClientInfo>(OpenFileManager);

            #if DEBUG
            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                return;
            }
            #endif

            server = new PaceServer();
            server.ClientConnected    += Server_ClientConnected;
            server.ClientDisconnected += Server_ClientDisconnected;

            server.PacketChannel.RegisterHandler <GetSystemInfoResponsePacket>(HandleSystemInfo);

            server.Start();
        }
Example #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var cnnService = new FarmingConnectionService();
            var authSnackbarMessageQueue = new SnackbarMessageQueue();
            var cnnViewModel             = new SignInViewModel(cnnService, authSnackbarMessageQueue);
            var authView = new AuthorizationView(cnnViewModel, authSnackbarMessageQueue);

            ConnectionEventHandler onSuccessfulSignIn = null;

            onSuccessfulSignIn = (obj, _e) =>
            {
                cnnService.SuccessfulSignIn -= onSuccessfulSignIn;

                var navigation           = new Navigation();
                var snackbarMessageQueue = new SnackbarMessageQueue();
                var mainViewModel        = new MainViewModel(_e.User, navigation, "FARMING inc.", snackbarMessageQueue);

                MainWindow = new MainWindow(mainViewModel, snackbarMessageQueue);
                authView.Close();
                MainWindow.Show();
            };

            cnnService.SuccessfulSignIn += onSuccessfulSignIn;

            authView.Show();

            base.OnStartup(e);
        }
Example #5
0
 public SettingsWindow(SettingsStats settingsStats)
 {
     InitializeComponent();
     SettingsStats        = settingsStats;
     DataContext          = this;
     MyCustomMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(1000));
 }
        public GroupShareViewModel(string roomId)
        {
            if (string.IsNullOrWhiteSpace(roomId))
            {
                return;
            }
            Snackbar = new SnackbarMessageQueue();
            room     = new Room()
            {
                id = roomId
            }.GetByRoomId();

            if (room != null)
            {
                var memlist = new DataofMember()
                {
                    groupid = room.id
                }.GetListByRoomId();
                if (memlist.Count == 0)
                {
                    APIHelper.GetRoomDetialByRoomId(room.id);
                    memlist = new DataofMember()
                    {
                        groupid = room.id
                    }.GetListByRoomId();
                }
                var user = memlist.FirstOrDefault(m => m.userId == Applicate.MyAccount.userId /*查询出自己的身份编号*/);
                role            = user.role;
                AllowUploadFile = room.allowUploadFile == 1 || user.role != MemberRole.Member;
            }
            uploadList = new ObservableCollection <RoomShare>();
            GetRoomShare();
            RegisterMessengers();
        }
Example #7
0
        public void Screenshot(FrameworkElement element)
        {
            var renderTargetBitmap = new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight, 96, 96, PixelFormats.Pbgra32);

            renderTargetBitmap.Render(element);
            var encoder = new PngBitmapEncoder();

            encoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap));

            var bitmapImage = new BitmapImage();

            using (var stream = new MemoryStream())
            {
                encoder.Save(stream);
                stream.Seek(0, SeekOrigin.Begin);

                bitmapImage.BeginInit();
                bitmapImage.CacheOption  = BitmapCacheOption.OnLoad;
                bitmapImage.StreamSource = stream;
                bitmapImage.EndInit();
            }

            Clipboard.SetImage(bitmapImage);

            SnackbarMessageQueue.Enqueue("Screenshot copied to clipboard", null, null, null, false, false, TimeSpan.FromSeconds(2));
        }
Example #8
0
        public AdminWindow(int signedInAdminID)
        {
            InitializeComponent();
            AdminWindowObject = this;

            signedInAdmin = new AdminModel(signedInAdminID);

            // Initialize DataContext with signedInAdmin Model
            DataContext = signedInAdmin;

            ControlUpdateNewAdminPasswordGrid(signedInAdmin.ID);

            // Initialize AdminWindowPages Objects

            AdminHomePageObject       = new AdminHomePage();
            ChallengesSetupPageObject = new ChallengesSetupPage();
            AdminSettingsPageObject   = new AdminSettingsPage();

            // Initialize Listbox Selected Index
            AdminWindowPagesListBox.SelectedIndex = 0;

            // Intialize MessagesQueue and Assign it to MessagesSnackbar's MessageQueue
            var MessagesQueue = new SnackbarMessageQueue(System.TimeSpan.FromMilliseconds(2000));

            MessagesSnackbar.MessageQueue = MessagesQueue;
        }
Example #9
0
        /// <summary>
        /// Evènement après que l'on ait essayé d'ajouter une personne
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddingPersonEvenHandler(object sender, string e)
        {
            var messageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(2000));

            SNBPerson.MessageQueue = messageQueue;
            SNBPerson.MessageQueue.Enqueue(e);
        }
Example #10
0
        private async void BtnCancel_Click(object sender, RoutedEventArgs e)
        {
            if ((m_cancelTokenSource != null && !m_cancelTokenSource.IsCancellationRequested) || !download_cts.IsCancellationRequested)
            {
                await ShowDialogHost2Buttons("Do you really want to abort current operation?");

                if (dialogClose_atom)
                {
                    if (m_cancelTokenSource != null)
                    {
                        m_cancelTokenSource.Cancel();
                    }
                    if (!download_cts.IsCancellationRequested)
                    {
                        download_cts.Cancel();
                    }
                    dialogClose_atom = false;
                    var myMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(4000));
                    SnackbarMain.MessageQueue = myMessageQueue;
                    SnackbarMain.Opacity      = 0.85;
                    var snackQueue   = SnackbarMain.MessageQueue;
                    var snackMessage = SnackbarMain.Message;

                    //  await Task.Factory.StartNew(() => snackQueue.Enqueue("Aborted successfully!", "OK", () => HandleUndoMethod()));
                }
            }
        }
Example #11
0
        protected override void OnStart()
        {
            string environmentName = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT");

            var config = new ConfigurationBuilder()
                         .SetBasePath(Directory.GetCurrentDirectory())
                         .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                         .AddJsonFile($"appsettings.{environmentName}.json", optional: true, reloadOnChange: true);

            configuration = config.Build();

            Log.Logger = new LoggerConfiguration()
                         .ReadFrom.Configuration(configuration)
                         .CreateLogger();

            mapperConfig = new MapperConfiguration(cfg =>
            {
                cfg.DisableConstructorMapping();
                cfg.AddProfile <MapperProfile>();
            });

            var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>();

            optionsBuilder.UseSqlite(configuration.GetConnectionString("Database"));

            database = new DatabaseContext(optionsBuilder.Options);

            SetupExceptionHandling();

            messageQueue = new SnackbarMessageQueue();

            Log.Debug("Configuration done");
        }
Example #12
0
        private async void cpbValue_Changed(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            if (cpb.Value == 100)
            {
                download_cts.Cancel();
                DockColors("Updated");
                statusBox.Text = "UPDATED";
                textBox1.Text  = "All files are up-to-date!\n\n";
                showUpd        = true;
                var myMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(3000));
                SnackbarMain.MessageQueue = myMessageQueue;
                SnackbarMain.Opacity      = 0.85;
                //SnackbarMain.ActionButtonStyle = (Style)FindResource("MaterialDesignSnackbarActionDarkButton");
                var snackQueue   = SnackbarMain.MessageQueue;
                var snackMessage = SnackbarMain.Message;
                //

                //the message queue can be called from any thread
                await Task.Factory.StartNew(() => snackQueue.Enqueue("FINISHED!", "OK", () => HandleUndoMethod()));
            }
            if (showErr == true)
            {
                DockColors("Error");
                statusBox.Text = "Check your connection";
            }
        }
Example #13
0
        private async void window_rendered(object sender, EventArgs e)
        {
            presentationSource.ContentRendered -= window_rendered;
            if (showErr)
            {
                await ShowDialogHost("Error while fetching .json\nCheck your connection!");

                statusBox.Text = "Check your connection";
            }
            else
            {
                var txt = new Label();

                var myMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(3000));
                SnackbarMain.MessageQueue = myMessageQueue;
                SnackbarMain.Opacity      = 0.85;
                //SnackbarMain.ActionButtonStyle = (Style)FindResource("MaterialDesignSnackbarActionDarkButton");
                var snackQueue   = SnackbarMain.MessageQueue;
                var snackMessage = SnackbarMain.Message;
                //
                statusBox.Text = "waiting for command";
                //the message queue can be called from any thread
                // await Task.Factory.StartNew(() => snackQueue.Enqueue("Ready for work", "UNDERSTOOD", () => HandleUndoMethod()));
            }
        }
 public AddPingDialog(Pings pings)
 {
     InitializeComponent();
     AddPingEnterKeyCommand = new MyICommand(OnAddPingEnterKeyCommand);
     NotificationQueue      = new SnackbarMessageQueue(TimeSpan.FromSeconds(5));
     _pings = pings;
 }
Example #15
0
        public MainWindow()
        {
            InitializeComponent();

            // Initialize messageQueue and Assign it to Snack bar's MessageQueue
            var messageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(2));

            Snackbar.MessageQueue = messageQueue;

            // Initialize CiphersComboBox
            CiphersComboBox.ItemsSource       = CiphersList.Instance;
            CiphersComboBox.DisplayMemberPath = "DisplayName";

            // Initialize NewCipherDialog
            NewCipherDialog.Context = this;

            // Disable Actions
            EnableActions(false);

            // Clear initial block from RichTextBoxes
            InputRichTextBox.Clear();
            OutputRichTextBox.Clear();

            // Check for updates
            CheckForUpdates();
        }
Example #16
0
        public ShellViewModel(
            IMessageBoxManager messageBoxManager,
            IWellDataImporter wellDataImporter,
            IWellProvider wellProvider,
            ITankProvider tankProvider,
            IWindowManager windowManager,
            IFactory <AddWellViewModel> wellViewModelFactory,
            IAutoUpdater autoUpdater)
        {
            _messageBoxManager    = messageBoxManager;
            _wellDataImporter     = wellDataImporter;
            _wellProvider         = wellProvider;
            _tankProvider         = tankProvider;
            _windowManager        = windowManager;
            _wellViewModelFactory = wellViewModelFactory;
            _autoUpdater          = autoUpdater;
            WellItems             = new BindableCollection <WellModel>();
            TankItems             = new BindableCollection <TankModel>();
            MessageQueue          = new SnackbarMessageQueue(TimeSpan.FromSeconds(2))
            {
                IgnoreDuplicate = true
            };

            _propertyObserver = new PropertyObserver <ShellViewModel>(this);

            _propertyObserver.OnChangeOf(x => x.SelectedWell).Do((vm) => LoadTanks(vm.SelectedWell).ConfigureAwait(false));
        }
 public ViewDesigns()
 {
     Navigator   = Navigator.Instance;
     Rooms       = LoadRooms();
     EditCommand = new ArgumentCommand <Design>(
         design => {
         Navigator.Push(new DesignEditorView(design));
         ;
     }
         );
     DeleteCommand    = new ArgumentCommand <Design>(DeleteDesign);
     CancelCommand    = new BasicCommand(ClosePopup);
     AddDesignCommand = new BasicCommand(AddDesign);
     ReloadCommand    = new BasicCommand(Reload);
     OpenPopup        = new BasicCommand(
         () => {
         IsAdding = true;
         OnPropertyChanged();
     }
         );
     //Om te voorkomen dat unit tests falen
     if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
     {
         RenderDesigns();
         MessageQueue = new SnackbarMessageQueue();
     }
 }
        public FeedBoxUserControlViewModel(IEventAggregator eventAggregator)
        {
            _logger.Log("Initialize the viewmodel for the feeds", Category.Info, Priority.Medium);
            ChangeFeedCommand = new DelegateCommand <FeedViewModel>(ClickedFeedView);
            _eventAggregator  = eventAggregator;

            AddArchiveFeedDelegateCommand = new DelegateCommand <FeedViewModel>(AddArchiveFeed);
            SearchCommand      = new DelegateCommand(SearchWithTerm);
            CleanFilterCommand = new DelegateCommand(Reset);

            eventAggregator.GetEvent <FetchDataEvent>().Subscribe(ShouldUpdateFeedList);
            eventAggregator.GetEvent <WantFeedEvent>().Subscribe(UpdateFeedListWithClear);
            eventAggregator.GetEvent <WantAllFeedsEvent>().Subscribe(UpdateFeedListWithClear);

            _allFeeds = new ObservableCollection <FeedViewModel>();
            _allFeeds.CollectionChanged += (a, e) =>
            {
                RaisePropertyChanged(nameof(IsEmpty));
                RaisePropertyChanged(nameof(IsNotEmpty));
            };

            var myMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(5000));

            AddArchiveMessageQueue = myMessageQueue;
        }
 public AddFormDialogViewModel(Sensors sensors, SnackbarMessageQueue snackbar)
 {
     this.sensors  = sensors;
     Snackbar      = snackbar;
     SubmitCommand = new DelegateCommand(Submit);
     Models        = HttpService.SensorList;
 }
Example #20
0
        private void ConnexionFailed_EventHandler()
        {
            var messageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(2000));

            ConnexionSnackBar.MessageQueue = messageQueue;
            ConnexionSnackBar.MessageQueue.Enqueue("Connexion to hub failed");
        }
Example #21
0
 private void OnError(LogMessage logMessage)
 {
     SnackbarMessageQueue.Enqueue("An error has occured.", "View error", () =>
     {
         CurrViewModel = _container.GetInstance <LogViewModel>();
     }, true);
 }
Example #22
0
        private void Update_Click(object sender, RoutedEventArgs e)
        {
            //https://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/
            //using backgroundworker because the operations cannot be done on the UI thread
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += (o, ea) =>
            {
                UpdateTeamStats();
            };

            worker.RunWorkerCompleted += (o, ea) =>
            {
                //since you can't access UI elements on a seperate thread it needs to be done on the ui thread
                //currently the loading box is delayed until the dispatcher's code is done - not sure if there is a workaround for this
                Dispatcher.Invoke(() =>
                {
                    using (var context = new Tournament())
                    {
                        UpdateStanding();
                        var players = context.Users.Include(x => x.Teams).OrderByDescending(x => x.Points).ToList();
                        RefreshDataGrids(players);
                    }
                });

                ProgressIndicator.IsBusy = false;
                //snackbar indicating the tournament was successfully updated
                var myMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(3000));
                MySnackbar.MessageQueue = myMessageQueue;
                MySnackbar.MessageQueue.Enqueue("Stillingen blev opdateret!");
            };

            ProgressIndicator.IsBusy = true;
            worker.RunWorkerAsync();
        }
Example #23
0
        public void ShowSnackbar(string s)
        {
            var queue = new SnackbarMessageQueue(TimeSpan.FromSeconds(1));

            Snackbar.MessageQueue = queue;
            queue.Enqueue(s);
        }
Example #24
0
        public MainWindow()
        {
            InitializeComponent();

            // Initialize exception logging
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            try {
                Setup();
                SettingsManager.LoadConfig();
                ListenerManager           = new ListenerManager();
                AppWindow                 = this;
                MessageQueue              = new SnackbarMessageQueue(TimeSpan.FromSeconds(1));
                MainSnackbar.MessageQueue = MessageQueue;
                IsMaximized               = SettingsManager.Settings.MainWindowMaximized;
                WidthWin    = SettingsManager.Settings.MainWindowWidth ?? Width;
                HeightWin   = SettingsManager.Settings.MainWindowHeight ?? Height;
                IsMaximized = !IsMaximized;
                ToggleWin(this, null);
                WidthWin  = SettingsManager.Settings.MainWindowWidth ?? Width;
                HeightWin = SettingsManager.Settings.MainWindowHeight ?? Height;
                SetCurrentView(typeof(StandardView));                   // Generate Standard view model to show on startup

                SetCurrentMaps(SettingsManager.GetLatestCurrentMaps()); // Set currentmap to previously opened map
            } catch (Exception ex) {
                ex.Show();
            }
        }
        protected AppController()
        {
            id          = Interlocked.Increment(ref dialogId);
            MenuCommand = new UntrackedCommand(async parameter =>
            {
                if (Routes.Count <= 1)
                {
                    IsMenuOpen = !IsMenuOpen;
                }
                else
                {
                    var current = Routes.Current;
                    if (current.IsTransitioning || !current.IsOutsideTransitionReady)
                    {
                        return;
                    }

                    var handler  = current.DeactivateRequested;
                    var popRoute = handler == null || await handler();
                    if (popRoute)
                    {
                        await Routes.Pop(null);
                    }
                }
            });

            SnackbarMessageQueue = new SnackbarMessageQueue();
            Kernel = new StandardKernel();
        }
Example #26
0
        private async Task ProcessImage(String path)
        {
            try
            {
                string imageUrl = await GoogleDriveService.UploadImage(path);

                FeedbackModel.Image = imageUrl;
                SnackbarMessageQueue.Enqueue("Please Wait, We now verify your image");
                bool isConfident = await ImageAnlyzer.CheckIceCreamConfidentByPath(path);

                if (isConfident)
                {
                    SnackbarMessageQueue.Enqueue("Your image was verifyed successfully.");
                }
                else
                {
                    SnackbarMessageQueue.Enqueue("Sorry, Your image was not verifyed! please replace the image");
                    FeedbackModel.Image = "";
                }
            }
            catch (Exception e)
            {
                SnackbarMessageQueue.Enqueue("Sorry, it is impossible to add image now");
                FeedbackModel.Image = "";
            }
        }
        public EditFormDialogViewModel(Sensors sensors, Sensor selected, SnackbarMessageQueue snackbar)
        {
            this.sensors = sensors;
            Snackbar     = snackbar;
            EditCommand  = new DelegateCommand(SubmitEdit);
            Index        = sensors.List
                           .IndexOf(sensors.List.Where(sensor => sensor == selected).FirstOrDefault());
            Selected = selected;

            oldName     = Selected.Name;
            Name        = Selected.Name;
            Latitude    = selected.Latitude.ToString();
            Longitude   = selected.Longitude.ToString();
            Description = selected.Description;

            Models     = HttpService.SensorList;
            ToLinkWith = Models.Where(item => Selected.Link == item.Tag).First();
            Filter();

            if (Selected is WindowDoorSensor)
            {
                Open       = ((WindowDoorSensor)selected).Opened;
                OtherVis   = Visibility.Collapsed;
                DoorWindow = Visibility.Visible;
            }
            else
            {
                MinValue   = ((IHasRangeValue)selected).MinValue.ToString();
                MaxValue   = ((IHasRangeValue)selected).MaxValue.ToString();
                DoorWindow = Visibility.Collapsed;
                OtherVis   = Visibility.Visible;
            }
        }
Example #28
0
 public Signin()
 {
     InitializeComponent();
     app = ((App)Application.Current);
     app.communicator.forceRelease();
     MyMessageQueue = ((MainWindow)App.Current.MainWindow).MySnackbar.MessageQueue;
 }
Example #29
0
        public MainWindow()
        {
            // Initialize exception logging
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            try {
                AppWindow   = this;
                AppCommon   = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                AppDataPath = Path.Combine(AppCommon, "Mapping Tools");
                ExportPath  = Path.Combine(AppDataPath, "Exports");
                HttpClient  = new HttpClient();

                InitializeComponent();

                MessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(2));
                MainSnackbar.MessageQueue = MessageQueue;

                Setup();
                SettingsManager.LoadConfig();
                ListenerManager = new ListenerManager();

                if (SettingsManager.Settings.MainWindowRestoreBounds is Rect r)
                {
                    SetToRect(r);
                }
                SetFullscreen(SettingsManager.Settings.MainWindowMaximized);

                SetCurrentView(typeof(StandardView));                   // Generate Standard view model to show on startup

                SetCurrentMaps(SettingsManager.GetLatestCurrentMaps()); // Set currentmap to previously opened map
            } catch (Exception ex) {
                ex.Show();
            }
        }
Example #30
0
        public MainWindow()
        {
            try {
                AppWindow   = this;
                AppCommon   = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                AppDataPath = Path.Combine(AppCommon, "Mapping Tools");
                ExportPath  = Path.Combine(AppDataPath, "Exports");
                HttpClient  = new HttpClient();
                HttpClient.DefaultRequestHeaders.Add("user-agent", "Mapping Tools");

                InitializeComponent();

                Setup();
                SettingsManager.LoadConfig();
                ListenerManager = new ListenerManager();

                DataContext = new MainWindowVm();

                MessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(2));
                MainSnackbar.MessageQueue = MessageQueue;

                if (SettingsManager.Settings.MainWindowRestoreBounds.HasValue)
                {
                    SetToRect(SettingsManager.Settings.MainWindowRestoreBounds.Value);
                }

                SetFullscreen(SettingsManager.Settings.MainWindowMaximized);

                SetCurrentMaps(SettingsManager.GetLatestCurrentMaps()); // Set currentmap to previously opened map
            }
            catch (Exception ex) {
                ex.Show();
            }
        }