Ejemplo n.º 1
0
        private void DoCameraMagic()
        {
            //check droppedboxx folder exists
            var dropfolder = new DirectoryInfo(Settings.Instance.TempDirectory);

            if (!dropfolder.Exists)
            {
                dropfolder.Create();
            }

            string originalFileName;

            using (CameraCaptureDialog dlg = new CameraCaptureDialog())
            {
                dlg.Mode             = CameraCaptureMode.Still;
                dlg.InitialDirectory = dropfolder.FullName;
                dlg.StillQuality     = CameraCaptureStillQuality.High;
                dlg.Resolution       = Settings.Instance.GetCameraResolution();
                dlg.Title            = "Take a Photo";
                DialogResult res;
                try
                {
                    res = dlg.ShowDialog();
                    if (res != DialogResult.OK)
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                }

                this.Refresh();
                originalFileName = dlg.FileName;
            }
            //Now save the file!
            Host.Cursor = Cursors.WaitCursor;
            //If a File is selected select the folder its in
            if (!_selectedItem.Is_Dir)
            {
                _selectedItem = _selectedItem.Parent;
            }

            var tempFile = new FileInfo(originalFileName);

            MessageDialog.Show("Photo Uploading...", "OK", null);

            Uploader.BackgroundUpload(tempFile, _selectedItem);

            Host.Cursor = Cursors.Default;
        }