public void Init(AppUpdateWinItems _itemObj, bool autoUpdate)
        {
            if (_itemObj != null) {

                if (!autoUpdate) {
                    _updateUrl = _itemObj.DownloadLink;
                    var message = "Wollen Sie das Update zur Version " + _itemObj.Version + " installieren?";
                    lblUpdateInformation.Content = message;
                }
                else {
                    _updateUrl = _itemObj.DownloadLink;
                    chooseCanvas.Visibility = Visibility.Collapsed;
                    downloadCanvas.Visibility = Visibility.Visible;
                    AppUpdate.bytesDownloaded += Bytesdownloaded;
                    AppUpdate.GetUpdate(_updateUrl, "inWatchUpdateTemp.exe");
                    _downloadTimer.Start();
                    lblDownloadStatus.Content = "Update wird heruntergeladen...";
                }
            }
        }
        private void cmdCheckUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (_updateCheckedStatus == "UpTrue") {
                lblStatus.Visibility = Visibility.Visible;
                lblStatus.Width = 425;
                lblStatus.Content = "Klicken Sie hier um das Update zu installieren...";
                return;
            }

            if (_updateCheckedStatus == "UpFalse") {
                lblStatus.Visibility = Visibility.Visible;
                lblStatus.Width = 425;
                _updateCheckedStatus = "UpFalse";
                lblStatus.Content = "Sie benützen die aktuellste Version!";
                return;
            }

            cmdCheckUpdate.IsEnabled = false;
            lblStatus.Visibility = Visibility.Collapsed;
            Canvas.SetLeft(progressBarUpdate, 1);
            progressBarUpdate.Width = 425;
            progressBarUpdate.Visibility = Visibility.Visible;

            _updateProgressTimer = new DispatcherTimer();
            _updateProgressTimer.Interval = new TimeSpan(0, 0, 3);
            _updateProgressTimer.Start();
            _updateProgressTimer.Tick += (o, m) => {

                try {
                    _updateCount++;

                    if (_updateCount == 3) {

                        new Thread(() => {
                            if (AppUpdate.checkForInternetConnection()) {
                                var updateStatus = AppUpdate.checkForUpdate();
                                if (updateStatus != null && updateStatus.Count != 0) {
                                    if ((bool)updateStatus[0]) {

                                        App.Current.Dispatcher.Invoke(delegate {
                                            progressBarUpdate.Visibility = Visibility.Collapsed;
                                            lblStatus.Visibility = Visibility.Visible;
                                            lblStatus.Width = 425;
                                            lblStatus.Content = "Update verfügbar! Klicken Sie hier um das Update zu installieren...";

                                            _updateCheckedStatus = "UpTrue";
                                            _updateItem = new AppUpdateWinItems();
                                            _updateItem.Version = updateStatus[1].ToString();
                                            _updateItem.Message = updateStatus[2].ToString();
                                            _updateItem.DownloadLink = updateStatus[3].ToString();
                                            cmdCheckUpdate.IsEnabled = true;
                                        });
                                    }
                                    else {

                                        App.Current.Dispatcher.Invoke(delegate {
                                            progressBarUpdate.Visibility = Visibility.Collapsed;
                                            lblStatus.Visibility = Visibility.Visible;
                                            lblStatus.Width = 425;
                                            _updateCheckedStatus = "UpFalse";
                                            lblStatus.Content = "Sie benützen die aktuellste Version!";
                                            cmdCheckUpdate.IsEnabled = true;
                                        });
                                    }

                                }
                                else {
                                    progressBarUpdate.Visibility = Visibility.Collapsed;
                                    lblStatus.Visibility = Visibility.Visible;
                                    lblStatus.Width = 425;
                                    _updateCheckedStatus = "UpFalse";
                                    lblStatus.Content = "Fehler beim überprüfen...";
                                    cmdCheckUpdate.IsEnabled = true;
                                }
                            }
                            else {

                                // No Internet Connection
                                var dialogType = new DialogWinItems("FATALER FEHLER",
                                    "Updates konnten nicht übnerprüft werden. Es besteht keine Internetverbindung!");
                                var dialog = new DialogWin();
                                dialog.init(dialogType, DialogType.INTERNETFAIL);
                                dialog.ShowDialog();
                            }
                        }).Start();
                    }
                }
                catch (Exception ex) {
                    GeneralSettings.LogException(ex);
                }
            };
        }
        void checkUpdates()
        {
            try {
                if (AppUpdate.checkForInternetConnection()) {

                    new Thread(() => {

                        var updateStatus = AppUpdate.checkForUpdate();
                        App.Current.Dispatcher.Invoke(delegate {

                            if (updateStatus != null && updateStatus.Count != 0) {
                                if ((bool)updateStatus[0]) {
                                    if (!_autoUpdate) {
                                        lblNotifyInfo.Visibility = Visibility.Collapsed;
                                        imgUpdateIcon.Source = new BitmapImage(new Uri("/Images/inWatch.notification.png", UriKind.RelativeOrAbsolute));

                                        lblUpdateName.Content = "Update Vorhanden"; // Temporary hardcodet
                                        lblUpdateDate.Content = updateStatus[2].ToString();
                                        lblVersionNumber.Content = updateStatus[1].ToString();

                                        _updateItem = new AppUpdateWinItems();
                                        _updateItem.Version = updateStatus[1].ToString();
                                        _updateItem.Message = updateStatus[2].ToString();
                                        _updateItem.DownloadLink = updateStatus[3].ToString();
                                    }
                                    else {
                                        _updateItem = new AppUpdateWinItems();
                                        _updateItem.Version = updateStatus[1].ToString();
                                        _updateItem.Message = updateStatus[2].ToString();
                                        _updateItem.DownloadLink = updateStatus[3].ToString();
                                        var updateWin = new AppUpdateWin();
                                        Hide();
                                        updateWin.Init(_updateItem, _autoUpdate);
                                        updateWin.ShowDialog();
                                    }
                                }
                                else {
                                    imgUpdateIcon.Source = new BitmapImage(new Uri("/Images/inWatch.noNotification.png", UriKind.RelativeOrAbsolute));
                                    lblNotifyInfo.Visibility = Visibility.Visible;
                                    lblUpdateDate.Visibility = Visibility.Collapsed;
                                    lblVersionNumber.Visibility = Visibility.Collapsed;
                                    lblUpdateName.Visibility = Visibility.Collapsed;
                                    cnvUpdateLine.Visibility = Visibility.Collapsed;
                                }
                            }
                            else {
                                lblUpdateName.Content = "Failed to load...";
                            }
                        });

                    }).Start();
                }
                else {

                    // No Internet Connection
                    var dialogType = new DialogWinItems("FATALER FEHLER",
                        "inWatch benötigt eine Internetverbindung um ordnungsgemäß zu funktionieren!");
                    var dialog = new DialogWin();
                    dialog.init(dialogType, DialogType.INTERNETFAIL);
                    dialog.ShowDialog();
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message, "checkUpdates()()");
            }
        }