private void Btn_Save_Click(object sender, RoutedEventArgs e) { //try //{ if (TBox_Name.Text == string.Empty) { throw new Exception(); } ModelVideo newVideo = new ModelVideo() { Name = TBox_Name.Text, TypeItem = _typeVideo, PathIcon = TB_OpenFileIcon.Text, ItemPath = TB_OpenFileVideo.Text, VrSettingPath = TB_OpenFileSettings.Text, FileMotion = TB_OpenFileMoution.Text, PathToBannerVideo = TB_OpenFileVideoBanner.Text }; int?numMonitor = null; if (RBOneMonitor.IsChecked == true) { numMonitor = 1; } else if (RBTwoMonitor.IsChecked == true) { numMonitor = 2; } newVideo.MonitorNumber = numMonitor; if (TP_TimeOut.SelectedTime != null) { DateTime?nowDate = new DateTime(2000, 12, 12, 0, 0, 0); nowDate += TP_TimeOut.SelectedTime; newVideo.TimeOut = nowDate; } IconType?iconType = null; if (RBtn_Image.IsChecked == true) { iconType = IconType.Image; } else if (RBtn_Video.IsChecked == true) { iconType = IconType.Video; } newVideo.IconType = (IconType)iconType; if (isAddOrEdit) { _rep.ChangeVideo(_oldVideo, newVideo); } else { _rep.AddVideo(newVideo); } App.Frame.Navigate(new TablesPage(_typeVideo)); //} //catch(Exception ex) //{ // ValidationMessage.Text = "Вы не заполнили всех полей!"; //} }