示例#1
0
        public MainPageViewModel()
        {
            //Get Channels//
            var channels = Data_CRUD.GetChannels();

            Channel1 = channels[0] as UI_Channel_Display;
            Channel2 = channels[1] as UI_Channel_Display;



            MainButtonCommand = new MainPageCommand(MainButtonExecuted, param => this.CanMainButtonExecute);

            SettingsButtonCommand = new MainPageCommand(SettingsButtonExecuted, param => this.canExecute);
            PlaybackButtonCommand = new MainPageCommand(PlaybackButtonExecuted, param => this.canExecute);

            IsRecordingLeft_Command  = new MainPageCommand(IsRecordingLeftExecuted, param => this.CanExecute);
            IsRecordingRight_Command = new MainPageCommand(IsRecordingRightExecuted, param => this.CanExecute);


            Channel1FirstAlertCommand  = new MainPageCommand(Channel1FirstAlertCommand_Executed, param => this.canExecute);
            Channel1SecondAlertCommand = new MainPageCommand(Channel1SecondAlertCommand_Executed, param => this.canExecute);
            Channel1ThirdAlertCommand  = new MainPageCommand(Channel1ThirdAlertCommand_Executed, param => this.canExecute);

            Channel2FirstAlertCommand  = new MainPageCommand(Channel2FirstAlertCommand_Executed, param => this.canExecute);
            Channel2SecondAlertCommand = new MainPageCommand(Channe21SecondAlertCommand_Executed, param => this.canExecute);
            Channel2ThirdAlertCommand  = new MainPageCommand(Channel2ThirdAlertCommand_Executed, param => this.canExecute);


            Channel1_Playback_Command = new MainPageCommand(Channel1_Playback_Command_Executed, param => this.canExecute);
            Channel2_Playback_Command = new MainPageCommand(Channel2_Playback_Command_Executed, param => this.canExecute);
        }
示例#2
0
        private static List <I_UI_Channel_Display> MockChannel()
        {
            List <I_UI_Channel_Display> channelList = new List <I_UI_Channel_Display>();
            var bitmap = Bitmap.FromFile(System.IO.Path.Combine(System.Environment.CurrentDirectory, "657676.jpg"));
            //var channel2Bitmap = File.ReadAllBytes("Sample_Camera_Image_2.jpg");

            var imageBin          = ImageToByte(bitmap);
            var base64Img         = Convert.ToBase64String(imageBin);
            UI_Channel_Display ch = new UI_Channel_Display
            {
                ID          = 1,
                Description = "Kitchen",
                IsConnected = true,
                IsInDB      = true,
                IsRecording = false,
                Name        = "MICROSEVEN",
                Last_Alert  = new List <Status> {
                    new Status(DateTime.Now, AlertType.CameraCover), new Status(DateTime.Now.AddMinutes(10), AlertType.MotionDetection), new Status(DateTime.Now.AddMinutes(15), AlertType.EnterROI), new Status(DateTime.Now.AddMinutes(20), AlertType.ExitROI), new Status(DateTime.Now, AlertType.MotionDetection)
                },
                Image          = imageBin,
                SelectedAlerts = new UI_AlertSelection()
                {
                    First  = AlertType.MotionDetection,
                    Second = AlertType.None,
                    Third  = AlertType.None
                }
            };

            channelList.Add(ch);
            UI_AlertSelection a = new UI_AlertSelection();



            ch = new UI_Channel_Display
            {
                ID          = 2,
                Description = "Back door",
                IsConnected = false,
                IsInDB      = true,
                IsRecording = false,
                Name        = "DAHUA",
                Last_Alert  = new List <Status> {
                    new Status(DateTime.Now, AlertType.CameraCover), new Status(DateTime.Now.AddMinutes(10), AlertType.MotionDetection), new Status(DateTime.Now.AddMinutes(15), AlertType.EnterROI), new Status(DateTime.Now.AddMinutes(20), AlertType.ExitROI), new Status(DateTime.Now, AlertType.MotionDetection)
                },
                Image          = imageBin,
                SelectedAlerts = new UI_AlertSelection()
                {
                    First  = AlertType.MotionDetection,
                    Second = AlertType.CameraCover,
                    Third  = AlertType.CameraDisconnected
                }
            };


            channelList.Add(ch);
            return(channelList);
        }