Beispiel #1
0
        // 配置图像库打分表
        protected static bool ConfigImageVoteTable()
        {            
            try
            {
                MySqlHelper.ConfigMySqlDatabase(TableType.ImageVote);
            }
            catch (Exception ex)
            {
                MessageWin message_win = new MessageWin();
                message_win.ShowDialog("糟糕!图像打分数据库初始化失败!请检查是否启动了MySql.\n错误信息:" + ex.Message, "提示", MessageBoxButton.OK);
                return false;
            }

            return true;
        }
Beispiel #2
0
 // 导出数据表
 private void BtnExport_Click(object sender, RoutedEventArgs e)
 {
     string table_name = ComboBoxExportTable.SelectedValue.ToString();
     if (table_name == DatabaseHelper.ImageVoteTableNames[0])
     {
         if (SaveImageLibTableToExcel())
         {
             MessageWin message_win = new MessageWin();
             message_win.ShowDialog("数据导出成功!", "提示");
         }
         else
         {
             MessageWin message_win = new MessageWin();
             message_win.ShowDialog("噢……数据导出失败!", "错误");
         }
     }
     else
     {
         MessageWin message_win = new MessageWin();
         message_win.ShowDialog("阿噢~此功能暂未实现,请联系作者@陈晓智^ ^", "抱歉");
     }
 }
Beispiel #3
0
        /*
        private void Tab_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Contains(TabDatabase))
            {
                ProgressWinLoading = new ProgressWin("加载中");
                ProgressWinLoading.Owner = this;
                ProgressWinLoading.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
                ProgressWinLoading.Show();
                // Thread
                this.LoadingTimer = new BackgroundWorker();
                this.LoadingTimer.WorkerReportsProgress = true;
                this.LoadingTimer.WorkerSupportsCancellation = true;

                // Events
                this.LoadingTimer.DoWork += LoadingTimer_DoWork;
                this.LoadingTimer.RunWorkerCompleted += LoadingTimer_RunWorkerCompleted;

                this.LoadingTimer.RunWorkerAsync();
            }            
        }

        void LoadingTimer_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {            
            // 将数据显示到ListView
            ListViewExperimentDataRecords.ItemsSource = Records.DefaultView;
            TextBlockDisplayCount.Text = Records.Rows.Count.ToString();
            ProgressWinLoading.Close();
        }

        void LoadingTimer_DoWork(object sender, DoWorkEventArgs e)
        {
            LoadAllRecords();
        }
        */
        #endregion

        private void Hyperlink_Click(object sender, RoutedEventArgs e)
        {
            ProgressWinLoading = new ProgressWin("加载中", false);
            ProgressWinLoading.Owner = this;
            ProgressWinLoading.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            ProgressWinLoading.Show();

            int experiment_record_ID = Convert.ToInt32(((Hyperlink)sender).Tag.ToString());
            string file_name;
            try
            {
                if (Export.SaveExperimentDataToExcel(experiment_record_ID, out file_name, FileMode.CreateNew))
                {
                    Export.OpenFile(file_name);
                }
            }
            catch (System.Exception ex)
            {
                MessageWin message_win = new MessageWin();
                message_win.Owner = (Window)this.Parent;
                message_win.ShowDialog(ex.Message, "提示", MessageBoxButton.OK);
            }

            ProgressWinLoading.Close();                    
        }
Beispiel #4
0
        private void LBItemImageVote2_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            int start_index = 0;
            int end_index = 0;
            if (ImageVote2List[0].ExpIsChecked && ImageVote2List[1].ExpIsChecked)
            {
                start_index = 0;
                end_index = (int)(ImageDirectory.UndefinedSceneCount - 1);
            }
            else if (ImageVote2List[0].ExpIsChecked)
            {
                start_index = 0;
                end_index = (int)Math.Ceiling(ImageDirectory.UndefinedSceneCount * 0.5) - 1;
            }
            else if (ImageVote2List[1].ExpIsChecked)
            {
                start_index = (int)Math.Ceiling(ImageDirectory.UndefinedSceneCount * 0.5);
                end_index = (int)(ImageDirectory.UndefinedSceneCount - 1);
            }
            else
            {
                MessageWin message_win = new MessageWin();
                message_win.Owner = (Window)this.Parent;
                message_win.ShowDialog("请选择图像打分范围!", "提示", MessageBoxButton.OK);
                return;
            }

            // 配置图像库打分表
            if (!ConfigImageVoteTable())
                return;

            ThuIPsySystem.Experiments.ImageVote2.Trial imagelibvote = new ThuIPsySystem.Experiments.ImageVote2.Trial(start_index, end_index);
            imagelibvote.Owner = this;
            imagelibvote.ShowDialog();
        }
Beispiel #5
0
        private void LBItemKeyboardExpSet_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ExpType = ExpList.Where(l => l.ExpIsChecked == true).Select(l => l.ExpID).ToList<string>();
            if (ExpType == null || ExpType.Count == 0)
            {
                MessageWin message_win = new MessageWin();
                message_win.Owner = (Window)this.Parent;
                message_win.ShowDialog("请选择实验类型!", "提示", MessageBoxButton.OK);
                return;
            }

            // 配置键盘实验数据表
            if (!ConfigKeyExperimentTable())
                return;

            KeyExpControler exp = new KeyExpControler(ExpType);
            exp.Owner = this;
            exp.ShowDialog();
        }        
Beispiel #6
0
        private void BtnConfigImageLib_Click(object sender, RoutedEventArgs e)
        {
            // 导入图像库
            bool result = ImageDirectory.CreateConfigFile(TextBoxImagesPath.Text.Trim());
            MessageWin message_win = new MessageWin();
            message_win.Owner = (Window)this.Parent;
            if (result)  
                message_win.ShowDialog("成功导入图像!", "提示", MessageBoxButton.OK);
            else
                message_win.ShowDialog("导入图像失败!请检查文件夹命名规则是否符合: Scene/Face -- Negative/Positive/Neutral/Undefined", "提示", MessageBoxButton.OK);

            // 配置图像库打分表
            ConfigImageVoteTable();

            // 初始化图像打分实验面板
            InitImageVote();

            Flyouts[0].IsOpen = !Flyouts[0].IsOpen;
        }