예제 #1
0
        public static bool UpdateSchemeDialog(ref AnnoScheme scheme)
        {
            Window dialog = null;

            if (scheme.Type == AnnoScheme.TYPE.FREE)
            {
                dialog = new AnnoTierNewFreeSchemeWindow(ref scheme);
            }
            else if (scheme.Type == AnnoScheme.TYPE.DISCRETE)
            {
                dialog = new AnnoTierNewDiscreteSchemeWindow(ref scheme);
            }
            else if (scheme.Type == AnnoScheme.TYPE.CONTINUOUS)
            {
                dialog = new AnnoTierNewContinuousSchemeWindow(ref scheme);
            }
            else if (scheme.Type == AnnoScheme.TYPE.POINT)
            {
                dialog = new AnnoTierNewPointSchemeWindow(ref scheme);
            }
            else
            {
                return(false);
            }

            dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            dialog.ShowDialog();

            return(dialog.DialogResult.Value);
        }
예제 #2
0
        private void navigatorNewAnno_Click(object sender, RoutedEventArgs e)
        {
            if (Time.TotalDuration > 0)
            {
                AnnoTierNewSchemeWindow dialog = new AnnoTierNewSchemeWindow();
                dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                dialog.ShowDialog();

                if (dialog.DialogResult == true)
                {
                    AnnoScheme.TYPE annoType = dialog.Result();

                    if (DatabaseLoaded)
                    {
                        databaseAddNewAnnotation(annoType);
                    }
                    else
                    {
                        if (annoType == AnnoScheme.TYPE.FREE)
                        {
                            AnnoTierNewFreeSchemeWindow dialog2 = new AnnoTierNewFreeSchemeWindow();
                            dialog2.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            dialog2.ShowDialog();

                            if (dialog2.DialogResult == true)
                            {
                                AnnoScheme annoScheme = dialog2.Result;
                                AnnoList   annoList   = new AnnoList()
                                {
                                    Scheme = annoScheme
                                };
                                addAnnoTier(annoList);
                            }
                        }
                        else if (annoType == AnnoScheme.TYPE.DISCRETE)
                        {
                            AnnoTierNewDiscreteSchemeWindow dialog2 = new AnnoTierNewDiscreteSchemeWindow();
                            dialog2.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            dialog2.ShowDialog();

                            if (dialog2.DialogResult == true)
                            {
                                AnnoList annoList = dialog2.GetAnnoList();
                                addAnnoTier(annoList);
                            }
                        }
                        else if (annoType == AnnoScheme.TYPE.CONTINUOUS)
                        {
                            double defaultSr = 25.0;

                            foreach (IMedia m in mediaList.Medias)
                            {
                                if (m.IsVideo())
                                {
                                    defaultSr = m.GetSampleRate();
                                    break;
                                }
                            }

                            AnnoTierNewContinuousSchemeWindow.Input input = new AnnoTierNewContinuousSchemeWindow.Input()
                            {
                                SampleRate = defaultSr, MinScore = 0.0, MaxScore = 1.0, MinColor = Colors.LightBlue, MaxColor = Colors.Red
                            };
                            AnnoTierNewContinuousSchemeWindow dialog2 = new AnnoTierNewContinuousSchemeWindow(input);
                            dialog2.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            dialog2.ShowDialog();
                            if (dialog2.DialogResult == true)
                            {
                                AnnoScheme annoScheme = dialog2.Result;
                                AnnoList   annoList   = new AnnoList()
                                {
                                    Scheme = annoScheme
                                };
                                addAnnoTier(annoList);
                            }
                        }
                    }
                }
            }
            else
            {
                MessageTools.Warning("Nothing to annotate, load some data first.");
            }
        }