public void detectProblem() { FixWindow fixWindow = new FixWindow(); fixWindow.Show(); Close(); fixWindow.Run(TroubleShooter.Current.Patches); }
public void ProcessKey(KeyboardCommandData key) { if (CommonKeyboardProcessing.NavigationKeysProcessing(model, key)) { return; } var fix = GetCurrentFix(); if (fix == null && key.Command == KeyboardCommands.Face) { int position = 0; for (; position < model.Montage.SubtitleFixes.Count; position++) { if (model.Montage.SubtitleFixes[position].StartTime > model.WindowState.CurrentPosition) { break; } } model.Montage.SubtitleFixes.Insert(position, new SubtitleFix { StartTime = model.WindowState.CurrentPosition, Length = 2000 }); model.OnNonSignificantChanged(); return; } if (fix == null) { return; } int delta = 200; if (key.Ctrl) { delta = 100; } if (key.Shift) { delta = 50; } switch (key.Command) { case KeyboardCommands.LeftToLeft: fix.StartTime -= delta; fix.Length += delta; model.OnNonSignificantChanged(); return; case KeyboardCommands.LeftToRight: fix.StartTime += delta; fix.Length -= delta; model.OnNonSignificantChanged(); return; case KeyboardCommands.RightToLeft: fix.Length -= delta; model.OnNonSignificantChanged(); return; case KeyboardCommands.RightToRight: fix.Length += delta; model.OnNonSignificantChanged(); return; case KeyboardCommands.Drop: model.Montage.SubtitleFixes.Remove(fix); model.OnNonSignificantChanged(); return; case KeyboardCommands.Desktop: fix.Text = FixWindow.EnterText(fix.Text); return; } }
void MainWindow_Initialized(object sender, EventArgs e) { model = (EditorModel)DataContext; model.WindowState.PropertyChanged += WindowState_PropertyChanged; FaceVideo.Source = new Uri(model.Locations.FaceVideo.FullName); ScreenVideo.Source = new Uri(model.Locations.DesktopVideo.FullName); FaceVideo.LoadedBehavior = MediaState.Manual; ScreenVideo.LoadedBehavior = MediaState.Manual; ScreenVideo.Volume = 0; ModeChanged(); PositionChanged(); PausedChanged(); RatioChanged(); videoAvailable = model.Locations.FaceVideo.Exists; DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(timerInterval); timer.Tick += (s, a) => { CheckPlayTime(); }; timer.Start(); PreviewKeyDown += MainWindow_KeyDown; ModelView.MouseDown += Timeline_MouseDown; Slider.MouseDown += Timeline_MouseDown; FadesSwitcher.Content = model.Montage.CrossfadesEnabled ? "Fades ON" : "Fades OFF"; Save.Click += (s, a) => { model.Save(); }; Montage.Click += (s, a) => { model.Save(); RunProcess(Services.Montager, model.VideoFolder); }; Assembly.Click += (s, a) => { model.Save(); RunProcess(Services.Assembler, model.VideoFolder); }; RepairFace.Click += (s, a) => { model.Save(); IsEnabled = false; new Tuto.TutoServices.RepairService().DoWork(model.Locations.FaceVideo, true); IsEnabled = true; }; RepairDesktop.Click += (s, a) => { model.Save(); IsEnabled = false; new Tuto.TutoServices.RepairService().DoWork(model.Locations.DesktopVideo, false); IsEnabled = true; }; NoiseReduction.Click += (s, a) => { model.Save(); if (!model.Locations.ClearedSound.Exists) { var serv = new Tuto.TutoServices.NoiseReductionService(); serv.CreateCleanedMP3(model); MessageBox.Show("Cleaned.mp3 created"); } else { MessageBox.Show("Already cleared. Will be assembled with new sound."); } }; FadesSwitcher.Click += (s, a) => { if (model.Montage.CrossfadesEnabled == false) { model.Montage.CrossfadesEnabled = true; FadesSwitcher.Content = "Fades ON"; MessageBox.Show("Crossfades enabled"); } else { FadesSwitcher.Content = "Fades OFF"; model.Montage.CrossfadesEnabled = false; MessageBox.Show("Crossfades disabled"); } model.Save(); }; Help.Click += (s, a) => { var data = HelpCreator.CreateModeHelp(); var wnd = new HelpWindow(); wnd.DataContext = data; wnd.Show(); }; GoTo.Click += (s, a) => { var wnd = new FixWindow(); wnd.Title = "Enter time"; var result = wnd.ShowDialog(); if (!result.HasValue || !result.Value) { return; } var parts = wnd.Text.Text.Split(',', '.', '-', ' '); int time = 0; try { time = int.Parse(parts[0]) * 60 + int.Parse(parts[1]); } catch { MessageBox.Show("Incorrect string. Expected format is '5-14'"); return; } time *= 1000; int current = 0; foreach (var z in model.Montage.Chunks) { if (z.IsNotActive) { time += z.Length; } current += z.Length; if (current > time) { break; } } model.WindowState.CurrentPosition = time; }; Synchronize.Click += Synchronize_Click; Infos.Click += Infos_Click; }