Пример #1
0
        private void Camera_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                // Save file.
                string filename = string.Format("{0:yyyyMMdd-HHmmss}.jpg", DateTime.Now);

                int reducingRate = Int32.Parse(AppResources.ReducingRate);
                int photoQuality = Int32.Parse(AppResources.PhotoQuality);

                FileStorage.SaveToIsolatedStorage(e.ImageStream, filename, reducingRate, photoQuality);

                Model.File file = new Model.File();
                file.FileName = filename;
                file.FileSize = FileStorage.FileSize(filename);
                file.Uid = 0;

                RESTService service = new RESTService(AppResources.RESTServiceUri);
                service.CreateFile(file, onFileCreatedRemotely, onError);
            });
        }
Пример #2
0
        void onFileCreatedRemotely(Model.File file)
        {
            App.ViewModel.AddFile(file);

            Node node = new Node();
            node.Title = file.FileName;
            node.Type = AppResources.DrupalContentType;
            node.File = file;

            RESTService service = new RESTService(AppResources.RESTServiceUri);
            service.CreateNode(node, onNodeCreatedRemotely, onError);
        }