Esempio n. 1
0
        public MapPage()
        {
            this.InitializeComponent();

            viewModel        = new MapViewModel();
            camerasViewModel = new CamerasViewModel();

            string language = ApplicationData.Current.LocalSettings.Values["Language"] as string;

            resourceLoader = ResourceLoader.GetForCurrentView(language);

            GoBackCommand = new ButtonCommand(new System.Action(GoBack));
        }
Esempio n. 2
0
        public SettingsPage()
        {
            this.InitializeComponent();

            string language = ApplicationData.Current.LocalSettings.Values["Language"] as string;

            if (string.IsNullOrEmpty(language))
            {
                resourceLoader = ResourceLoader.GetForCurrentView("En-en");
            }
            else
            {
                resourceLoader = ResourceLoader.GetForCurrentView(language);
            }

            this.GoBackCommand = new ButtonCommand(new Action(() => this.Frame.GoBack()), () => true);
        }
Esempio n. 3
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            base.OnNavigatedTo(e);
            Camera camera = e.Parameter as Camera;

            this.CameraViewModel = new CameraViewModel(camera);

            this.GoBackCommand               = new ButtonCommand(new Action(GoBack));
            this.AddToFavouritesCommand      = new ButtonCommand(new Action(this.AddToFavourites));
            this.RemoveFromFavouritesCommand = new ButtonCommand(new Action(this.RemoveFromFavourites));

            if (this.CameraViewModel.CanExecuteAddToFavouritesCommand())
            {
                this.AddToFavouritesButton.Command = this.AddToFavouritesCommand;
            }
            else
            {
                this.AddToFavouritesButton.Command = this.RemoveFromFavouritesCommand;
                this.HeartIcon.Glyph = "\xEB52";
            }

            try
            {
                this.ffmpeg = await FFmpegInterop.FFmpegInteropMSS.CreateFromUriAsync(camera.RtspAddress);

                MediaStreamSource streamSource = ffmpeg.GetMediaStreamSource();

                this.MediaElement.SetMediaStreamSource(streamSource);
                this.MediaElement.Play();

                CameraViewModel.AddToRecent();
            }
            catch (System.Runtime.InteropServices.COMException exception)
            {
                ShowContentDialog(exception.Message);
                GoBack();
            }
        }
Esempio n. 4
0
        public UnknownCameraPage()
        {
            this.InitializeComponent();

            string language = ApplicationData.Current.LocalSettings.Values["Language"] as string;

            if (!string.IsNullOrEmpty(language))
            {
                this.resourceLoader = ResourceLoader.GetForCurrentView(language);
            }
            else
            {
                this.resourceLoader = ResourceLoader.GetForCurrentView("En-en");
            }

            this.UnknownCameraViewModel = new UnknownCameraViewModel();

            AddNewCameraCommand       = new ButtonCommand(new Action(AddCamera), () => false);
            NavigateToMainPageCommand = new ButtonCommand(new Action(() => this.Frame.Navigate(typeof(MainPage))));
        }
Esempio n. 5
0
        public MainPage()
        {
            this.InitializeComponent();
            CamerasViewModel = new CamerasViewModel();
            newCamera        = new NewCameraViewModel();

            string language = ApplicationData.Current.LocalSettings.Values["Language"] as string;

            if (!string.IsNullOrEmpty(language))
            {
                this.resourceLoader = ResourceLoader.GetForCurrentView(language);
            }
            else
            {
                this.resourceLoader = ResourceLoader.GetForCurrentView("En-en");
                ApplicationData.Current.LocalSettings.Values["Language"] = "En-en";
            }

            AddNewCameraCommand   = new ButtonCommand(new Action(AddCamera), () => false);
            RefreshCamerasCommand = new ButtonCommand(new Action(StartBackgroundTask));
        }