public MainPageViewModel(Dispatcher dispatcher)
        {
            this.audioRecorder = new AudioRecorder(dispatcher);
            this.audioRecorder.RecorderStopped += new EventHandler(RecorderStopped);
            this.audioRecorder.RecorderStarted += new EventHandler(RecorderStarted);
            this.pictureTaker = new PictureTaker();
            this.pictureTaker.TakePictureCompleted +=
                new EventHandler<CaptureImageCompletedEventArgs>(TakePictureCompleted);

            this.serverMonitor = new ServerMonitor(this.ServerMediaItems);
            this.serverMonitor.DownloadComplete += ((s, args) =>
            {
                if (!App.Current.IsRunningOutOfBrowser)
                {
                    var items = from i in this.ServerMediaItems
                                where i.IsAudio == false
                                orderby i.Name descending
                                select i;
                    var item = items.FirstOrDefault();
                    if (item != null)
                    {
                        HtmlPage.Window.Invoke("lastImageUploaded", item.Url);
                    }
                }

            });

            this.uploader = new Uploader(dispatcher, this.LocalMediaItems);
            this.uploader.QueueEmptied += ((s, args) =>
            {
                this.serverMonitor.Download();
            });

            this.serverMonitor.Download();
            this.AllowedDeviceAccess = CaptureDeviceConfiguration.AllowedDeviceAccess;
        }
Exemple #2
0
        public MainPageViewModel(Dispatcher dispatcher)
        {
            this.audioRecorder = new AudioRecorder(dispatcher);
            this.audioRecorder.RecorderStopped += new EventHandler(RecorderStopped);
            this.audioRecorder.RecorderStarted += new EventHandler(RecorderStarted);
            this.pictureTaker = new PictureTaker();
            this.pictureTaker.TakePictureCompleted +=
                new EventHandler <CaptureImageCompletedEventArgs>(TakePictureCompleted);

            this.serverMonitor = new ServerMonitor(this.ServerMediaItems);
            this.serverMonitor.DownloadComplete += ((s, args) =>
            {
                if (!App.Current.IsRunningOutOfBrowser)
                {
                    var items = from i in this.ServerMediaItems
                                where i.IsAudio == false
                                orderby i.Name descending
                                select i;
                    var item = items.FirstOrDefault();
                    if (item != null)
                    {
                        HtmlPage.Window.Invoke("lastImageUploaded", item.Url);
                    }
                }
            });

            this.uploader = new Uploader(dispatcher, this.LocalMediaItems);
            this.uploader.QueueEmptied += ((s, args) =>
            {
                this.serverMonitor.Download();
            });


            this.serverMonitor.Download();
            this.AllowedDeviceAccess = CaptureDeviceConfiguration.AllowedDeviceAccess;
        }