protected override void BindCommands() { SearchCameraCommand = new RelayCommand(() => { Status = ViewModelStatus.Loading; CameraCollection.Clear(); Model.SearchCameras(SearchCameraText, SearchCamerasCallback); }); RefreshCameraCommand = new RelayCommand(() => { SearchCameraText = string.Empty; Refresh(); }); PublishCameraCommand = new RelayCommand(() => { if (SelectedCamera == null) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("PublishMedia_CameraListView_PublishCameraNull"), ViewModelMessageBoxType.Error)); return; } Messenger.Default.Send(new NotificationMessage <Camera>(UIMessageType.PublishMedia_CameraSelectedEvent, SelectedCamera)); }); CancelCommand = new RelayCommand(() => { Messenger.Default.Send(new NotificationMessage(UIMessageType.PublishMedia_CancelSelectCameraEvent)); }); }
protected override void BindCommands() { RefreshServiceCommand = new RelayCommand(() => { ServiceCollection.Clear(); Status = ViewModelStatus.Initializing; Model.GetServices(GetServicesCallback); }); SelectServiceCommand = new RelayCommand(() => { if (SelectedService == null) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("PublishMedia_PublishServiceSelectionView_SelectedServiceNull"), ViewModelMessageBoxType.Error)); return; } Messenger.Default.Send(new NotificationMessage <PublishPair>(UIMessageType.PublishMedia_ServiceSelectedEvent, new PublishPair(SelectedService, SelectedCamera))); }); CancelCommand = new RelayCommand(() => { Messenger.Default.Send(new NotificationMessage(UIMessageType.PublishMedia_CancelSelectServiceEvent)); }); }
private void SelectFile() { try { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = LanguageString.Find("DeviceConfiguration_VideoSourceLocalAVIFileView_AVIFileFilter"); if (!string.IsNullOrEmpty(SelectedFilePath)) { FileInfo info = new FileInfo(SelectedFilePath); dialog.InitialDirectory = info.DirectoryName; } else { dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.CommonVideos); } if (dialog.ShowDialog() == DialogResult.OK) { SelectedFilePath = dialog.FileName; } } catch (Exception ex) { ExceptionHandler.Handle(ex); } }
private void DeleteCameraCallback(object sender, AsyncWorkerCallbackEventArgs <bool> args) { bool result = CheckAsyncWorkerCallback <bool>(sender, args, true, LanguageString.Find("DeviceConfiguration_CameraManagementView_DeleteCameraFailed")); Status = ViewModelStatus.Saved; Refresh(); }
private void UnpublishCameraCallback(object sender, AsyncWorkerCallbackEventArgs <bool> args) { bool result = CheckAsyncWorkerCallback <bool>(sender, args, true, LanguageString.Find("PublishMedia_PublishedCameraManagementView_DeletePublishedCameraFailed")); Status = ViewModelStatus.Saved; Refresh(); }
public static bool?Show(string message, string detail, MessageBoxWindowType windowType, MessageBoxWindowButtonsType buttonType) { MessageBoxWindow window = new MessageBoxWindow(); window.Message = message; window.Detail = detail; window.WindowType = windowType; window.ButtonsType = buttonType; switch (windowType) { case MessageBoxWindowType.Information: window.Title = LanguageString.Find("Presentation_Windows_MessageBoxWindow_Information"); break; case MessageBoxWindowType.Question: window.Title = LanguageString.Find("Presentation_Windows_MessageBoxWindow_Question"); break; case MessageBoxWindowType.Warning: window.Title = LanguageString.Find("Presentation_Windows_MessageBoxWindow_Warning"); break; case MessageBoxWindowType.Error: window.Title = LanguageString.Find("Presentation_Windows_MessageBoxWindow_Error"); break; default: window.Title = LanguageString.Find("Presentation_Windows_MessageBoxWindow_Information"); break; } return(window.ShowDialog()); }
private void PublishCameraCallback(object sender, AsyncWorkerCallbackEventArgs <bool> args) { bool result = CheckAsyncWorkerCallback <bool>(sender, args, true, LanguageString.Find("PublishMedia_PublishedCameraConfigurationView_PublishCameraFailed")); Status = ViewModelStatus.Saved; Messenger.Default.Send(new NotificationMessage(UIMessageType.PublishMedia_CameraPublishedEvent)); }
private void CheckPortAvailableCallback(object sender, AsyncWorkerCallbackEventArgs <bool> e) { bool result = CheckAsyncWorkerCallback <bool>(sender, e, true, LanguageString.Find("PublishMedia_PublishedCameraConfigurationView_CheckPortAvailableError")); Status = ViewModelStatus.Loaded; if (result) { CheckPortAvailableResult = (bool)(e.Data) ? CheckPortAvailableResultResultType.Available : CheckPortAvailableResultResultType.Unavailable; } }
private void UpdateCameraCallback(object sender, AsyncWorkerCallbackEventArgs <Camera> args) { bool result = CheckAsyncWorkerCallback <Camera>(sender, args, true, LanguageString.Find("DeviceConfiguration_CameraCreationView_UpdateCameraFailed")); Status = ViewModelStatus.Saved; if (result) { Messenger.Default.Send(new NotificationMessage <Camera>(UIMessageType.DeviceConfiguration_CameraUpdatedEvent, args.Data as Camera)); } }
public static bool?ShowQuestionYesNo(string message, string detail) { MessageBoxWindow window = new MessageBoxWindow(); window.Title = LanguageString.Find("Presentation_Windows_MessageBoxWindow_Question"); window.Message = message; window.Detail = detail; window.WindowType = MessageBoxWindowType.Information; window.ButtonsType = MessageBoxWindowButtonsType.YesNo; return(window.ShowDialog()); }
private void CheckCameraNameCallback(object sender, AsyncWorkerCallbackEventArgs <bool> e) { bool result = CheckAsyncWorkerCallback <bool>(sender, e, true, LanguageString.Find("DeviceConfiguration_CameraCreationView_CheckCameraNameError")); Status = ViewModelStatus.Loaded; if (result) { CheckCameraNameResult = (bool)(e.Data) ? CheckNameExistedResultType.NotExisted : CheckNameExistedResultType.IsExisted; } _syncWork.Set(); // 操作已完成 }
private Camera MakeCheckedCamera() { if (string.IsNullOrEmpty(CameraName)) { Messenger.Default.Send(new ViewModelMessageBoxMessage( this, LanguageString.Find("DeviceConfiguration_CameraCreationView_CameraNameNull"), ViewModelMessageBoxType.Error)); return(null); } Camera camera = CameraFactory.CreateCamera(); camera.Name = CameraName; return(camera); }
protected override void BindCommands() { RefreshServiceCommand = new RelayCommand(() => { ServiceCollection.Clear(); Status = ViewModelStatus.Initializing; Model.GetServices(GetServicesCallback); }); ConnectServiceCommand = new RelayCommand(() => { if (SelectedService == null) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("DeviceConfiguration_ServiceSelectionView_PleaseSelectService"), ViewModelMessageBoxType.Error)); return; } // navigate to camera list view Messenger.Default.Send(new NotificationMessage <MediaService>(UIMessageType.DeviceConfiguration_ServiceSelectedEvent, SelectedService)); }); }
public void LoginCallback(object sender, AsyncWorkerCallbackEventArgs <bool> args) { bool result = CheckAsyncWorkerCallback <bool>(sender, args, true, LanguageString.Find("UserManagement_LoginView_ServerFailed")); Status = ViewModelStatus.Loaded; if (result) { LoginResult = (bool)args.Data; if (!LoginResult) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("UserManagement_LoginView_InvalidUserNameOrPassword"), ViewModelMessageBoxType.Error)); } if (LoginResultCallback != null) { LoginResultCallback(LoginResult); } } }
protected override void BindCommands() { CreateCommand = new RelayCommand(() => { Messenger.Default.Send(new NotificationMessage(UIMessageType.DeviceConfiguration_CreateCameraEvent)); }); UpdateCommand = new RelayCommand(() => { if (SelectedCamera == null) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("DeviceConfiguration_CameraManagementView_SelectTargetEditCamera"), ViewModelMessageBoxType.Error)); return; } Messenger.Default.Send(new NotificationMessage <Camera>(UIMessageType.DeviceConfiguration_UpdateCameraEvent, SelectedCamera)); }); DeleteCommand = new RelayCommand(() => { if (SelectedCamera == null) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("DeviceConfiguration_CameraManagementView_SelectTargetDeleteCamera"), ViewModelMessageBoxType.Error)); return; } Status = ViewModelStatus.Saving; Model.DeleteCamera(SelectedCamera, DeleteCameraCallback); }); CancelCommand = new RelayCommand(() => { Messenger.Default.Send(new NotificationMessage(UIMessageType.DeviceConfiguration_SelectServiceEvent)); }); RefreshCommand = new RelayCommand(() => { Refresh(); }); }
protected override Camera MakeCamera() { if (SelectedVideoSourceDescription == null) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("DeviceConfiguration_CameraCreationView_PleaseSelectCameraSource"), ViewModelMessageBoxType.Error)); return(null); } if (string.IsNullOrEmpty(CameraName)) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("DeviceConfiguration_CameraCreationView_CameraNameNull"), ViewModelMessageBoxType.Error)); return(null); } Camera camera = UpdatedCamera; camera.Name = CameraName; camera.Description = CameraDescription; camera.VideoSourceDescription = SelectedVideoSourceDescription; camera.Tags = CameraTags; return(camera); }
protected override void BindCommands() { CreateCommand = new RelayCommand(() => { Messenger.Default.Send(new NotificationMessage(UIMessageType.PublishMedia_CreatePublishedCameraEvent)); }); DeleteCommand = new RelayCommand(() => { if (SelectedPublishedCamera == null) { Messenger.Default.Send(new ViewModelMessageBoxMessage(this, LanguageString.Find("PublishMedia_PublishedCameraManagementView_SelectTargetDeletePublishedCamera"), ViewModelMessageBoxType.Error)); return; } Status = ViewModelStatus.Saving; Model.UnpublishCamera(SelectedPublishedCamera.PublishServiceUri, SelectedPublishedCamera, UnpublishCameraCallback); }); RefreshCommand = new RelayCommand(() => { Refresh(); }); }
public void RefreshTitle() { Title = LanguageString.Find(TitleSource); }
private void GetServicesCallback(object sender, AsyncWorkerCallbackEventArgs <IList <MediaService> > e) { bool result = CheckAsyncWorkerCallback <IList <MediaService> >(sender, e, true, LanguageString.Find("DeviceConfiguration_ServiceSelectionView_GetServicesFailed")); Status = ViewModelStatus.Loaded; ServiceCollection.Clear(); if (result) { foreach (var item in e.Data) { ServiceCollection.Add(item); } } }
public static void LoadNavigationMenu() { items.Clear(); MenuItem miLive = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Live"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miLive.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_LiveVideo"), Command = NavigationCommands.ShowLiveVideoCameraListCommand }); miLive.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_VideoSplice"), IsEnabled = false }); miLive.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_VideoCarousel"), IsEnabled = false }); miLive.Items.Add(new Separator()); miLive.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Bookmark"), IsEnabled = false }); MenuItem miRecord = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Record"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miRecord.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_RetrieveVideoPlayback"), IsEnabled = false }); miRecord.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_PlayLocalFile"), IsEnabled = false }); miRecord.Items.Add(new Separator()); miRecord.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_RecordScheduler"), IsEnabled = false }); MenuItem miIntelligence = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Intelligence"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miIntelligence.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_IntelligentAlarm"), IsEnabled = false }); miIntelligence.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_IntelligentSearch"), IsEnabled = false }); miIntelligence.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_IntelligentAnalysis"), IsEnabled = false }); MenuItem miMap = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Map"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miMap.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_FloorImage"), IsEnabled = false }); miMap.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_WebMap"), IsEnabled = false }); MenuItem miDevice = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Device"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miDevice.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_DeviceManagement"), Command = NavigationCommands.ManageCameraCommand }); miDevice.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_ServiceTopology"), IsEnabled = false }); MenuItem miPublish = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Publish"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miPublish.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Tweet"), IsEnabled = false }); miPublish.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_VideoUpload"), IsEnabled = false }); miPublish.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_PublishMedia"), Command = NavigationCommands.PublishMediaCommand }); MenuItem miUser = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_User"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miUser.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_UserManagement"), IsEnabled = false }); miUser.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_RoleConfiguration"), IsEnabled = false }); MenuItem miLayout = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Window"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miLayout.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Cascade"), Command = NavigationCommands.ChangeLayoutCascadeCommand }); miLayout.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Horizontal"), Command = NavigationCommands.ChangeLayoutTileHorizontalCommand }); miLayout.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Vertical"), Command = NavigationCommands.ChangeLayoutTileVerticalCommand }); miLayout.Items.Add(new Separator()); MenuItem miSplit = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Split") }; miSplit.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Split1"), IsEnabled = false }); miSplit.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Split2"), IsEnabled = false }); miSplit.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Split4"), IsEnabled = false }); miSplit.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Split6"), IsEnabled = false }); miSplit.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Split9"), IsEnabled = false }); miSplit.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Split12"), IsEnabled = false }); miSplit.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Split16"), IsEnabled = false }); miLayout.Items.Add(miSplit); MenuItem miTools = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Tools"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miTools.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Skins"), Command = NavigationCommands.UpdateSkinCommand }); MenuItem miLanguage = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Languages") }; miLanguage.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_ChineseSimplified"), Command = NavigationCommands.ChangeLanguage_zh_CN_Command }); miLanguage.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_English"), Command = NavigationCommands.ChangeLanguage_en_US_Command }); miTools.Items.Add(miLanguage); miTools.Items.Add(new Separator()); miTools.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Options"), IsEnabled = false }); MenuItem miHelp = new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Help"), Width = 60, HorizontalContentAlignment = HorizontalAlignment.Left }; miHelp.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_OnlineHelp"), Command = NavigationCommands.HelpOnlineCommand }); miHelp.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_CheckForUpdates"), Command = NavigationCommands.CheckUpdateCommand }); miHelp.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_ReportABug"), Command = NavigationCommands.ReportBugCommand }); miHelp.Items.Add(new Separator()); miHelp.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_TermsOfUse"), IsEnabled = false }); miHelp.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_PrivacyStatement"), IsEnabled = false }); miHelp.Items.Add(new MenuItem() { Header = LanguageString.Find("Navigation_Menu_Abort"), Command = NavigationCommands.SeeAboutCommand }); // calculate the menu item width, so that we can make the display more beautiful items.Add(CalculateMenuWidth(miLive)); items.Add(CalculateMenuWidth(miRecord)); items.Add(CalculateMenuWidth(miIntelligence)); items.Add(CalculateMenuWidth(miMap)); items.Add(CalculateMenuWidth(miDevice)); items.Add(CalculateMenuWidth(miPublish)); items.Add(CalculateMenuWidth(miUser)); items.Add(CalculateMenuWidth(miLayout)); items.Add(CalculateMenuWidth(miTools)); items.Add(CalculateMenuWidth(miHelp)); // notify that the navigation menu ites were changed RaiseNavigationMenuChangedEvent(); }
private void GetDesktopFiltersCallback(object sender, AsyncWorkerCallbackEventArgs <IList <DesktopFilter> > e) { bool result = CheckAsyncWorkerCallback <IList <DesktopFilter> >(sender, e, true, LanguageString.Find("DeviceConfiguration_CameraCreationView_GetLocalDesktopFailed")); Status = ViewModelStatus.Loaded; if (result) { Messenger.Default.Send(new MultipleContentNotificationMessage <IList <DesktopFilter>, VideoSourceDescription>( UIMessageType.DeviceConfiguration_UpdateLocalDesktopVideoSourceEvent) { FirstContent = e.Data, SecondContent = this.SelectedVideoSourceDescription, }); } }
public static bool?ShowInformation(string message, string detail) { return(Show(message, detail, MessageBoxWindowType.Information, MessageBoxWindowButtonsType.Ok, LanguageString.Find("Presentation_Windows_MessageBoxWindow_Information"))); }
public static bool?ShowWarning(string message, string detail) { return(Show(message, detail, MessageBoxWindowType.Warning, MessageBoxWindowButtonsType.Ok, LanguageString.Find("Presentation_Windows_MessageBoxWindow_Warning"))); }
private void GetDesktopFiltersCallback(object sender, AsyncWorkerCallbackEventArgs <IList <DesktopFilter> > e) { bool result = CheckAsyncWorkerCallback <IList <DesktopFilter> >(sender, e, true, LanguageString.Find("DeviceConfiguration_VideoSourceNavigationView_GetLocalDesktopFailed")); Status = ViewModelStatus.Loaded; if (result) { Messenger.Default.Send(new NotificationMessage <IList <DesktopFilter> >(UIMessageType.DeviceConfiguration_SelectLocalDesktopVideoSourceEvent, e.Data)); } }
private void GetCamerasCallback(object sender, AsyncWorkerCallbackEventArgs <IList <Camera> > args) { bool result = CheckAsyncWorkerCallback <IList <Camera> >(sender, args, true, LanguageString.Find("DeviceConfiguration_CameraManagementView_GetCamerasFailed")); CameraCollection.Clear(); Status = ViewModelStatus.Loaded; if (result) { foreach (var item in (args.Data as IList <Camera>)) { CameraCollection.Add(item); } } }
private void GetPublishedCamerasCallback(object sender, AsyncWorkerCallbackEventArgs <IList <PublishedCamera> > args) { bool result = CheckAsyncWorkerCallback <IList <PublishedCamera> >(sender, args, true, LanguageString.Find("PublishMedia_PublishedCameraManagementView_GetPublishedCamerasFailed")); PublishedCameraCollection.Clear(); if (result) { foreach (var item in (args.Data as IList <PublishedCamera>)) { PublishedCameraCollection.Add(item); } } Status = ViewModelStatus.Loaded; }
private void SearchCamerasCallback(object sender, AsyncWorkerCallbackEventArgs <IList <Camera> > args) { bool result = CheckAsyncWorkerCallback <IList <Camera> >(sender, args, true, LanguageString.Find("PublishMedia_CameraListView_SearchError")); CameraCollection.Clear(); if (result) { foreach (var item in (args.Data as IList <Camera>)) { CameraCollection.Add(item); } } Status = ViewModelStatus.Loaded; }