Ejemplo n.º 1
0
        /**
         * Load all files of an emotion-type and feed them into the ActionUnit and Emotion-detection algorithms.
         * @param string type - emotion type
         */
        private void loadFiles(string type)
        {
            loading = true;
            string dir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\Recordings\\";

            string[]      files           = Directory.GetFiles(dir);
            List <string> filesOfInterest = new List <string>();

            foreach (string f in files)
            {
                if (f.EndsWith(type))
                {
                    filesOfInterest.Add(f.Substring(0, f.Length - type.Length - 1));
                }
            }
            elementPanel.Controls.Clear();
            int index = 0;

            foreach (string s in filesOfInterest)
            {
                DataSetView dsv = new DataSetView(s, type, index);
                elementPanel.Controls.Add(dsv);
                index++;
            }

            arrange();
            loading = false;
        }
Ejemplo n.º 2
0
        static void SimpleBuild()
        {
            string outputPath;

            if ((outputPath = EditorUtility.SaveFolderPanel("Save output to", "", "")) != "")
            {
                float ratio = 0;
                float step  = 0;
                if (Directory.EnumerateFileSystemEntries(outputPath).Any())
                {
                    if (!EditorUtility.DisplayDialog("Target not Empty", "The target folder isn't empty, Overwrite?", "Yes", "Cancel"))
                    {
                        return;
                    }
                }

                EditorUtility.DisplayProgressBar("Building Project", "", ratio);

                // Step 1: Create Folder
                EditorUtility.DisplayProgressBar("Building Project", "Create project structure", (ratio += 0.1f));
                string moduleDataFolder = Path.Combine(outputPath, "ModuleData");
                Directory.CreateDirectory(moduleDataFolder);

                // Step 2: Create DataSet
                ElementConfig[] configs = ConfigManager.Datasets;
                step = 0.7f / configs.Length;
                foreach (var config in configs)
                {
                    EditorUtility.DisplayProgressBar("Building Project", "Create Dataset " + config.Name, (ratio += step));

                    MB2CustomEditorView view;
                    if (!ElementViewManager.GetView(config.Name, out view))
                    {
                        view = new DataSetView();
                    }
                    view.Init(config);

                    File.WriteAllText(moduleDataFolder + "/" + config.Name + ".xml", view.GetData());
                }

                // Step 3: Create SubModule.xml
                EditorUtility.DisplayProgressBar("Building Project", "Create SubModule.xml", (ratio = 0.8f));
                CreateSubModule(outputPath + "SubModule.xml");

                EditorUtility.ClearProgressBar();
                EditorUtility.DisplayDialog("Built finished", "Built successfully!", "Ok");
                EditorUtility.RevealInFinder(moduleDataFolder);
            }
        }
Ejemplo n.º 3
0
 /**
  * Update the whole UI according to the current frame's values.
  */
 private void loadFrame()
 {
     while (true)
     {
         Thread.Sleep(100);
         if (!loading) // prevent interference with loading Files!
         {
             foreach (Control c in elementPanel.Controls)
             {
                 if (c.GetType() == typeof(DataSetView))
                 {
                     DataSetView dsv = (DataSetView)c;
                     dsv.udpateAndVisualizeData();
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        /**
         * Sets up the UI and starts the Updater-Thread, which will Update the lables and progressbars displaying the ActionUnit- and Emotion-Values
         */
        public AnalyzerView()
        {
            MinimumSize = new Size(cellWidth, 300);
            InitializeComponent();
            elementPanel.FlowDirection = FlowDirection.TopDown;
            elementPanel.AutoScroll    = true;
            elementPanel.WrapContents  = false;
            elementPanel.Bounds        = new Rectangle(0, menuStrip1.Height, Width, Height - 100);
            controlPanel.Bounds        = new Rectangle(0, menuStrip1.Height + elementPanel.Height, Width, 50);
            Controls.Add(elementPanel);
            Controls.Add(controlPanel);
            this.scrubber.Value         = 0;
            this.scrubber.TickFrequency = 1;
            this.scrubber.Maximum       = 299;
            this.scrubber.TickStyle     = TickStyle.None;
            this.scrubber.Scroll       += (sender, e) =>
            {
                currentFrame = scrubber.Value;

                foreach (Control c in elementPanel.Controls)
                {
                    if (c.GetType() == typeof(DataSetView))
                    {
                        DataSetView dsv = (DataSetView)c;
                        if (dsv.vlcControl.IsPlaying)
                        {
                            dsv.vlcControl.Pause();
                        }
                        dsv.vlcControl.Position = (float)currentFrame / 300f;
                    }
                }
            };
            this.controlPanel.Controls.Add(scrubber);
            Text = "Record Analyzer";

            Bounds = Screen.PrimaryScreen.Bounds;
            arrange();
            this.Show();

            updaterThread = new Thread(loadFrame);
            updaterThread.Start();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Update the <see cref="System.Data.DataTable"/> and <see cref="DataGridView"/> so it shows the updated data.
        /// </summary>
        /// <param name="check">The default value for the <see cref="ColCheck"/> column.</param>
        /// <param name="checkX">The default value for the <see cref="ColX"/> column.</param>
        /// <param name="checkY">The default value for the <see cref="ColY"/> column.</param>
        public void UpdateDataTable(DefaultCheck check = DefaultCheck.None, DefaultCheck checkX = DefaultCheck.None, DefaultCheck checkY = DefaultCheck.None)
        {
            // Clear the data and view so no duplicates will be shown.
            DataSetView.DataSource = null;
            DataTable.Clear();
            if (check != DefaultCheck.LastState)
            {
                DoInclude = new List <bool>();
            }
            if (checkX != DefaultCheck.LastState)
            {
                DoIncludeX = new List <bool>();
            }
            if (checkY != DefaultCheck.LastState)
            {
                DoIncludeY = new List <bool>();
            }

            // Get the new data.
            for (var i = 0; i < SelectedDataSet.DataList.Count; i++)
            {
                var row = DataTable.NewRow();
                if (DataTable.Columns.Contains(ColCheck))
                {
                    switch (check)
                    {
                    case DefaultCheck.All:
                        row[ColCheck] = true;
                        break;

                    case DefaultCheck.Numeric:
                        row[ColCheck] = SelectedDataSet.DataList[i].IsNumeric;
                        break;

                    case DefaultCheck.Nonnumeric:
                        row[ColCheck] = !SelectedDataSet.DataList[i].IsNumeric;
                        break;

                    case DefaultCheck.None:
                        row[ColCheck] = false;
                        break;

                    case DefaultCheck.LastState:
                        row[ColCheck] = DoInclude[i];
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(check), check, null);
                    }
                    if (DoInclude.Count != SelectedDataSet.DataList.Count)
                    {
                        DoInclude.Add(row[ColCheck] as bool? ?? false);
                    }
                    else
                    {
                        DoInclude[i] = row[ColCheck] as bool? ?? false;
                    }
                }
                if (DataTable.Columns.Contains(ColX) && DataTable.Columns.Contains(ColY))
                {
                    switch (checkX)
                    {
                    case DefaultCheck.All:
                        row[ColX] = true;
                        break;

                    case DefaultCheck.Numeric:
                        row[ColX] = SelectedDataSet.DataList[i].IsNumeric;
                        break;

                    case DefaultCheck.Nonnumeric:
                        row[ColX] = !SelectedDataSet.DataList[i].IsNumeric;
                        break;

                    case DefaultCheck.None:
                        row[ColX] = false;
                        break;

                    case DefaultCheck.LastState:
                        row[ColX] = DoIncludeX[i];
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(check), check, null);
                    }
                    switch (checkY)
                    {
                    case DefaultCheck.All:
                        row[ColY] = true;
                        break;

                    case DefaultCheck.Numeric:
                        row[ColY] = SelectedDataSet.DataList[i].IsNumeric;
                        break;

                    case DefaultCheck.Nonnumeric:
                        row[ColY] = !SelectedDataSet.DataList[i].IsNumeric;
                        break;

                    case DefaultCheck.None:
                        row[ColY] = false;
                        break;

                    case DefaultCheck.LastState:
                        row[ColY] = DoIncludeY[i];
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(check), check, null);
                    }
                    if (DoIncludeX.Count != SelectedDataSet.DataList.Count)
                    {
                        DoIncludeX.Add(row[ColX] as bool? ?? false);
                    }
                    else
                    {
                        DoIncludeX[i] = row[ColX] as bool? ?? false;
                    }
                    if (DoIncludeY.Count != SelectedDataSet.DataList.Count)
                    {
                        DoIncludeY.Add(row[ColY] as bool? ?? false);
                    }
                    else
                    {
                        DoIncludeY[i] = row[ColY] as bool? ?? false;
                    }
                }
                if (DataTable.Columns.Contains(ColVarName))
                {
                    row[ColVarName] = SelectedDataSet.DataList[i].Name;
                }
                if (DataTable.Columns.Contains(ColRange))
                {
                    row[ColRange] = SelectedDataSet.DataList[i].Range.Address();
                }
                if (DataTable.Columns.Contains(ColRangeName))
                {
                    row[ColRangeName] = SelectedDataSet.DataList[i].RangeName.Name;
                }
                if (DataTable.Columns.Contains(ColNumeric))
                {
                    row[ColNumeric] = SelectedDataSet.DataList[i].IsNumeric;
                }
                DataTable.Rows.Add(row);
            }

            // Update the view.
            DataSetView.DataSource = DataTable;
            DataSetView.Sort(DataSetView.Columns[ColRange], ListSortDirection.Ascending);
        }
Ejemplo n.º 6
0
 public DataSetController(DataSetView data_set_view)
 {
     _data_set_view = data_set_view;
     _data_set_repo = new DataSetRepository();
 }
 protected override void DataSetChanged(DataSet oldDataSet, DataSet newDataSet)
 {
     base.DataSetChanged(oldDataSet, newDataSet);
     DataSetView.SetDataSet(newDataSet);
 }