Esempio n. 1
0
        void Infos_Click(object sender, RoutedEventArgs e)
        {
            var times   = new List <int>();
            var current = 0;

            foreach (var c in model.Montage.Chunks)
            {
                if (c.StartsNewEpisode)
                {
                    times.Add(current);
                    current = 0;
                }
                if (c.Mode == Mode.Face || c.Mode == Mode.Desktop)
                {
                    current += c.Length;
                }
            }
            times.Add(current);

            if (model.Montage.Information.Episodes.Count == 0)
            {
                model.Montage.Information.Episodes.AddRange(Enumerable.Range(0, times.Count).Select(z => new EpisodInfo(Guid.NewGuid())));
            }
            else if (model.Montage.Information.Episodes.Count != times.Count)
            {
                while (model.Montage.Information.Episodes.Count > times.Count)
                {
                    model.Montage.Information.Episodes.RemoveAt(model.Montage.Information.Episodes.Count - 1);
                }
                while (model.Montage.Information.Episodes.Count < times.Count)
                {
                    model.Montage.Information.Episodes.Add(new EpisodInfo(Guid.NewGuid()));
                }
            }

            for (int i = 0; i < times.Count; i++)
            {
                model.Montage.Information.Episodes[i].Duration = TimeSpan.FromMilliseconds(times[i]);
            }

            var wnd = new InfoWindow();

            wnd.DataContext = model.Montage.Information;
            wnd.ShowDialog();
            model.Save();
        }
Esempio n. 2
0
        void Infos_Click(object sender, RoutedEventArgs e)
        {
            var times   = new List <int>();
            var current = 0;

            foreach (var c in model.Montage.Chunks)
            {
                if (c.StartsNewEpisode)
                {
                    times.Add(current);
                    current = 0;
                }
                if (c.Mode == Mode.Face || c.Mode == Mode.Screen)
                {
                    current += c.Length;
                }
            }
            times.Add(current);

            if (model.Montage.Information.Episodes.Count == 0)
            {
                model.Montage.Information.Episodes.AddRange(Enumerable.Range(0, times.Count).Select(z => new EpisodInfo()));
            }
            else if (model.Montage.Information.Episodes.Count != times.Count)
            {
                MessageBox.Show("The stored information contains wrong count of records, i.e. describes wrong number of episodes. Please check it", "", MessageBoxButton.OK, MessageBoxImage.Information);
                while (model.Montage.Information.Episodes.Count < times.Count)
                {
                    model.Montage.Information.Episodes.Add(new EpisodInfo());
                }
            }

            for (int i = 0; i < times.Count; i++)
            {
                model.Montage.Information.Episodes[i].Duration = TimeSpan.FromMilliseconds(times[i]);
            }

            var wnd = new InfoWindow();

            wnd.DataContext = model.Montage.Information;
            wnd.ShowDialog();
            ModelIO.Save(model);
        }
Esempio n. 3
0
        void Infos_Click(object sender, RoutedEventArgs e)
        {
            var times = new List<int>();
            var current = 0;
            foreach (var c in model.Montage.Chunks)
            {
                if (c.StartsNewEpisode)
                {
                    times.Add(current);
                    current = 0;
                }
                if (c.Mode == Mode.Face || c.Mode == Mode.Screen)
                    current += c.Length;
            }
            times.Add(current);

            if (model.Montage.Information.Episodes.Count == 0)
            {
                model.Montage.Information.Episodes.AddRange(Enumerable.Range(0, times.Count).Select(z => new EpisodInfo(Guid.NewGuid())));
            }
            else if (model.Montage.Information.Episodes.Count != times.Count)
            {
                while (model.Montage.Information.Episodes.Count > times.Count)
                    model.Montage.Information.Episodes.RemoveAt(model.Montage.Information.Episodes.Count - 1);
                while (model.Montage.Information.Episodes.Count < times.Count)
                    model.Montage.Information.Episodes.Add(new EpisodInfo(Guid.NewGuid()));
            }

            for (int i = 0; i < times.Count; i++)
                model.Montage.Information.Episodes[i].Duration = TimeSpan.FromMilliseconds(times[i]);

            var wnd = new InfoWindow();
            wnd.DataContext = model.Montage.Information;
            wnd.ShowDialog();
            model.Save();
        }