예제 #1
0
        static bool dealWhenDataIsNull(string typeName)
        {
            string message = string.Format("\"{0}\"数据为空,无法执行导出操作!", typeName);

            DialogWin.Show(message, "提示", DialogWinImage.Information);
            return(false);
        }
예제 #2
0
        public static bool SerializeToFile <T>(T data, string typeName, string extension) where T : class
        {
            if (data == null)
            {
                return(dealWhenDataIsNull(typeName));
            }
            string filter   = string.Format("{0}文件(*.{1}) | *.{1}", typeName, extension);
            string fileName = FileSelector.SelectSaveFile(filter);

            try
            {
                if (!string.IsNullOrWhiteSpace(fileName))
                {
                    JsonParser.SerializeToFile <T>(data, fileName, true);
                    string message = string.Format("成功导出{0}文件!", typeName);
                    DialogWin.Show(message, "导出成功", DialogWinImage.Information);
                }
            }
            catch
            {
                string message = string.Format("{0}\"{1}\"导出失败!", typeName, fileName);
                DialogWin.Show(message, "导出错误", DialogWinImage.Error);
            }
            return(false);
        }
예제 #3
0
 private void doSaveVideo()
 {
     //TODO:保存视频录像。
     DialogWin.Show("保存视频录像部分暂未开发!", DialogWinImage.Warning);
     if (SaveVideoAction != null)
     {
         SaveVideoAction();
     }
 }
예제 #4
0
 public static void SavedByHandle(Image img, string videoName)
 {
     if (img != null)
     {
         saveImage(img, videoName);
     }
     else
     {
         DialogWin.Show("获取视频截图失败!");
     }
 }
예제 #5
0
        public static T DeserializeFromFile <T>(string typeName, string extension) where T : class
        {
            string filter   = string.Format("{0}(*.{1}) | *.{1}", typeName, extension);
            string fileName = FileSelector.SelectOpenFile(filter);

            try
            {
                if (!string.IsNullOrWhiteSpace(fileName))
                {
                    return(JsonParser.DeserializeFromFile <T>(fileName));
                }
            }
            catch
            {
                string message = string.Format("{0}\"{1}\"导入失败,请检查文件中数据是否匹配!", typeName, fileName);
                DialogWin.Show(message, "导入失败", DialogWinImage.Error);
            }
            return(null);
        }
예제 #6
0
 private void doShortcut(object obj)
 {
     if (splitPanel.ViewModel != null && !(splitPanel.ViewModel.OnSwitching || splitPanel.ViewModel.IsOnEditting))
     {
         ShortcutItem si = obj as ShortcutItem;
         if (si != null && si.FileName != null)
         {
             if (!File.Exists(si.FileName))
             {
                 DialogWin.Show("未找到布局文件:" + si.FileName, DialogWinImage.Warning);
                 return;
             }
             SplitScreenInfo data = JsonParser.DeserializeFromFile <SplitScreenInfo>(si.FileName);
             if (data != null)
             {
                 LayoutScheme.Instance.Scheme.SplitScreenData = data;
             }
         }
     }
 }
예제 #7
0
        private void snapshot()
        {
            //ImageSaver.SavedByHandle(DisplayModel.GetSnapshot());
            var img = DisplayModel.GetSnapshot();

            if (img != null)
            {
                string name = DisplayModel.VideoName;
                if (string.IsNullOrWhiteSpace(name))
                {
                    name = "未知视频";
                }
                PreviewWin.Show(img, name);
                if (SnapshotEvent != null)
                {
                    SnapshotEvent();
                }
            }
            else
            {
                DialogWin.Show("未获取到视频数据。", DialogWinImage.Information);
            }
        }
예제 #8
0
        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);
                }
            };
        }
예제 #9
0
        private async void Btn_Query_Click(object sender, RoutedEventArgs e)
        {
            string asin = this.TBox_Asin.Text.Trim();

            if (IsNullOrEmpty(asin))
            {
                MessageBox.Show("输入ASIN!");
                return;
            }
            List <string> lines      = Utils.GetLines(this.TBox_KeyWords.LineCount, i => this.TBox_KeyWords.GetLineText(i));
            int           linesCount = lines.Count;

            if (linesCount <= 0)
            {
                MessageBox.Show("输入关键词!");
                return;
            }

            if (this.CBoxCountry.SelectedValue == null)
            {
                MessageBox.Show("选择站点!");
                return;
            }

            int searchType = this.CBoxSearchType.SelectedIndex;

            //var dialogWin1 = new DialogWin();
            //dialogWin1.Title = "搜索结果";
            //SResultUCtrl srUCtrl1 = new SResultUCtrl();
            //srUCtrl1.UpdateDataSource(new List<SearchModel> {
            //    new SearchModel
            //    {
            //     Asin=asin,
            //     KeyWord="ddd",
            //     SResult = new SearchResult()
            //    }
            //});
            //dialogWin1.Container.Children.Add(srUCtrl1);
            //dialogWin1.ShowDialog();

            //return;

            setSearchStatus(false);
            var selectValue  = this.CBoxCountry.SelectedValue;
            var clientResult = await Utils.GetInitCacheClientAsync(selectValue, OuputLine);

            if (clientResult.Success)
            {
                updateKwProcess(0, linesCount);
                string Link = selectValue.Link;
                // 启动线程处理队列
                var queryResultList = await queryResultListAsync(lines, clientResult.Data, asin, Link, searchType, process => updateKwProcess(process, linesCount));

                queryResultList = queryResultList.OrderBy(o => lines.IndexOf(o.KeyWord)).ToList();
                if (queryResultList.Count > 0)
                {
                    var dialogWin = new DialogWin();
                    dialogWin.Title  = "搜索结果";
                    dialogWin.Width  = 450;
                    dialogWin.Height = 200;
                    SResultUCtrl sRCtrl = new SResultUCtrl();
                    dialogWin.Container.Children.Add(sRCtrl);
                    sRCtrl.UpdateDataSource(queryResultList);
                    dialogWin.Show();
                }
            }

            setSearchStatus(true);
        }
예제 #10
0
        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()()");
            }
        }