public void ChangeVideo(ModelVideo oldVideo, ModelVideo newVideo) { if (oldVideo != null && newVideo != null) { oldVideo.Name = newVideo.Name; oldVideo.IconType = newVideo.IconType; oldVideo.PathIcon = newVideo.PathIcon; oldVideo.ItemPath = newVideo.ItemPath; oldVideo.TypeItem = newVideo.TypeItem; oldVideo.MonitorNumber = newVideo.MonitorNumber; oldVideo.VrSettingPath = newVideo.VrSettingPath; oldVideo.FileMotion = newVideo.FileMotion; oldVideo.TimeOut = newVideo.TimeOut; oldVideo.PathToBannerVideo = newVideo.PathToBannerVideo; context.SaveChanges(); if (oldVideo.TypeItem == TypeItem.Video360) { if (RefreshTableVideo360 != null) { RefreshTableVideo360.Invoke(this, null); } } if (oldVideo.TypeItem == TypeItem.Video5D) { if (RefreshTableVideo5D != null) { RefreshTableVideo5D.Invoke(this, null); } } return; } throw new Exception("Video not found"); }
public void DeleteVideo(ModelVideo video) { if (video != null) { context.Videos.Remove(video); context.SaveChanges(); if (video.TypeItem == TypeItem.Video360) { if (RefreshTableVideo360 != null) { RefreshTableVideo360.Invoke(this, null); } } if (video.TypeItem == TypeItem.Video5D) { if (RefreshTableVideo5D != null) { RefreshTableVideo5D.Invoke(this, null); } } return; } throw new Exception("Виедо не выбрано"); }
public OpenVrPleyerHelper(ModelVideo video) { try { Video = video; NameProcess = "VrPlayer.exe"; #if (DEBUG) WorkingDirectory = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + @"\VrPlayer\VrPlayer\bin\Debug"; #else WorkingDirectory = Directory.GetParent(Directory.GetCurrentDirectory()).FullName + @"\VrPlayer"; #endif if (!IsProcessOpened) { ProcessStartInfo proc = new ProcessStartInfo(); // proc.UseShellExecute = true; proc.WorkingDirectory = WorkingDirectory; proc.FileName = NameProcess; proc.Verb = "runas"; proc.Arguments = StartupParameters + "-config:\"" + video.VrSettingPath + "\" -media:\"" + video.ItemPath + "\""; _currentProcess = new Process { StartInfo = proc }; } } catch (Exception ex) { App.SendException(ex); } }
public VideoControlerPage(ModelVideo video) : this() { InitializeComponent(); _currentVideo = video; VideoBanner.VideoCollection = new List <Uri>() { new Uri(video.PathToBannerVideo) }; _typeItem = TypeItem.Video360; Start = ResumeVideo; Stop = StopVideo; Pause = PauseVideo; Launch = LaunchingVideo; Btn_Start.IsEnabled = false; Btn_Stop.IsEnabled = false; Btn_Pause.IsEnabled = false; NameVideo.Text = video.Name; if (video.TimeOut != null) { Hour.Text = video.TimeOut.Value.Hour.ToString(); Minutes.Text = video.TimeOut.Value.Minute.ToString(); Second.Text = video.TimeOut.Value.Second.ToString(); } else { TimerPanel.Visibility = Visibility.Hidden; } _videoProcessor = new OpenVrPleyerHelper(video); _timeOut = video.TimeOut.Value.TimeOfDay; if (video.MonitorNumber != null) { _videoProcessor.MonitorNumber = video.MonitorNumber.Value; } else { _videoProcessor.MonitorNumber = 2; } _service = new ClientService(); _timerEnd = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 1) }; _timerEnd.Tick += _timerStop_Tick; App.IsVideoMod = true; Observer.SetItem(_videoProcessor); }
public VideoAddOrEditDialogPage(TypeItem videoType, ModelVideo editVideo) { try { InitializeComponent(); _rep = App.Repository; _oldVideo = editVideo; _typeVideo = videoType; TBox_Name.Text = _oldVideo.Name; TB_OpenFileIcon.Text = _oldVideo.PathIcon; TB_OpenFileVideo.Text = _oldVideo.ItemPath; TB_OpenFileVideoBanner.Text = _oldVideo.PathToBannerVideo; if (_oldVideo.MonitorNumber == 1) { RBOneMonitor.IsChecked = true; } else if (_oldVideo.MonitorNumber == 2) { RBTwoMonitor.IsChecked = true; } TB_OpenFileSettings.Text = _oldVideo.VrSettingPath; TB_OpenFileMoution.Text = _oldVideo.FileMotion; if (_oldVideo.TimeOut != null) { selectedTime = _oldVideo.TimeOut.Value.TimeOfDay; TP_TimeOut.SelectedTime = selectedTime; } else { TP_TimeOut.SelectedTime = new TimeSpan(0, 0, 30); } if (_oldVideo.IconType == IconType.Image) { RBtn_Image.IsChecked = true; } else if (_oldVideo.IconType == IconType.Video) { RBtn_Video.IsChecked = true; } isAddOrEdit = true; } catch (Exception ex) { App.SendException(ex); } }
private void DownloadListDoa(String respondResult) { JObject jresult = JObject.Parse(respondResult); JArray jdata = JArray.Parse(jresult.SelectToken("result").ToString()); foreach (JObject item in jdata) { ModelVideo mVideo = new ModelVideo(); mVideo.idVideo = item.SelectToken("idVideo").ToString(); mVideo.judulVideo = item.SelectToken("judulVideo").ToString(); mVideo.video = Navigation.BASE_URL + "/api/public/video/" + item.SelectToken("video").ToString(); mVideo.keterangan = item.SelectToken("keterangan").ToString(); mVideo.sumber = item.SelectToken("sumber").ToString(); collectionvideo.Add(mVideo); } }
public void AddVideo(ModelVideo video) { context.Videos.Add(video); context.SaveChanges(); if (video.TypeItem == TypeItem.Video360) { if (RefreshTableVideo360 != null) { RefreshTableVideo360.Invoke(this, null); } } if (video.TypeItem == TypeItem.Video5D) { if (RefreshTableVideo5D != null) { RefreshTableVideo5D.Invoke(this, null); } } }
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 = "Вы не заполнили всех полей!"; //} }
private Page GetPageByName(string pageName, object param1, object param2 = null) { switch (pageName) { case (nameof(StartUpPage)): { bool p = (bool)param1; return(new StartUpPage(p)); } case (nameof(AuthorizePage)): { bool p = (bool)param1; return(new AuthorizePage(p)); } case (nameof(GameAddOrEditDialogPage)): { ModelGame p = (ModelGame)param1; return(new GameAddOrEditDialogPage(p)); } case (nameof(MainSettingPage)): { bool p = (bool)param1; return(new MainSettingPage(p)); } case (nameof(TablesPage)): { TypeItem p = (TypeItem)param1; return(new TablesPage(p)); } case (nameof(VideoAddOrEditDialogPage)): { if (param2 == null) { TypeItem p = (TypeItem)param1; return(new VideoAddOrEditDialogPage(p)); } else { TypeItem p1 = (TypeItem)param1; ModelVideo p2 = (ModelVideo)param2; return(new VideoAddOrEditDialogPage(p1, p2)); } } case (nameof(VideoControlerPage)): { if (param1 is ModelVideo) { ModelVideo p = (ModelVideo)param1; return(new VideoControlerPage(p)); } else { ModelGame p = (ModelGame)param1; return(new VideoControlerPage(p)); } } default: throw new ArgumentException(); } }