Ejemplo n.º 1
1
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     image1.Source = null;
     PhotoChooserTask objPhotoChooser = new PhotoChooserTask();
     objPhotoChooser.Completed += new EventHandler<PhotoResult>(PhotoChooseCall);
     objPhotoChooser.Show();
 }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                PhotoChooserTask photoChooserTask           = new PhotoChooserTask();
                photoChooserTask.Completed += (ee,s)=>
                {
                    //DirectX context should be recreate before cereate the texture
                    Dispatcher.BeginInvoke(() =>
                   {
                       WriteableBitmap bmp = new WriteableBitmap(1,1);
                       bmp.SetSource(s.ChosenPhoto);
  
                       m_d3dInterop.CreateTexture(bmp.Pixels, bmp.PixelWidth, bmp.PixelHeight);
                       MessageBox.Show("Picture loaded with c#");
                   });


                };

                photoChooserTask.Show();

            }
            catch(Exception exp)
                {
                }
        }
Ejemplo n.º 3
0
 public SubirExamen()
 {
     InitializeComponent();
     this.Loaded                     += InicializaLsitPicker;
     this.photoChooserTask            = new PhotoChooserTask();
     this.photoChooserTask.Completed += new EventHandler <PhotoResult>(photoChooserTask_Completed);
 }
Ejemplo n.º 4
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (pixelatedImage.Source == null && e.IsNavigationInitiator)
            {
                var task = new PhotoChooserTask();
                task.Completed += OnPhotoChooserTaskCompleted;
                task.ShowCamera = true;
                task.Show();
            }

            if (pixelationListBox.Items.Count == 0)
            {
                pixelationListBox.Items.Add(3);
                pixelationListBox.Items.Add(4);
                pixelationListBox.Items.Add(5);
                pixelationListBox.Items.Add(6);
                pixelationListBox.Items.Add(7);
                pixelationListBox.Items.Add(8);
                pixelationListBox.Items.Add(9);
                pixelationListBox.Items.Add(10);
            }

            var pixelateSize = new PixelationSizeQuery().Get();
            pixelationListBox.SelectedItem = pixelateSize; // TODO: don't work
            pixelationListBox.SelectionChanged += OnPixelationListBoxSelectionChanged;
            _pixelator = new Pixelator(pixelateSize, false);

            sliderDebug.ValueChanged += OnSliderDebugValueChanged;
        }
Ejemplo n.º 5
0
        internal static void WriteImageToFile(WriteableBitmap bmp, string tempJPEG)
        {
            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (myIsolatedStorage.FileExists(tempJPEG))
                {
                    myIsolatedStorage.DeleteFile(tempJPEG);
                }

                IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(tempJPEG);
                StreamResourceInfo        sri        = null;
                Uri uri = new Uri(tempJPEG, UriKind.Relative);
                sri = Application.GetResourceStream(uri);

                Extensions.SaveJpeg(bmp, fileStream, bmp.PixelWidth, bmp.PixelHeight, 0, 85);
                fileStream.Close();
            }

            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile(tempJPEG, FileMode.Open, FileAccess.Read))
                {
                    MediaLibrary mediaLibrary = new MediaLibrary();
                    Picture      pic          = mediaLibrary.SavePicture(tempJPEG, fileStream);
                    fileStream.Close();
                }
            }

            PhotoChooserTask photoChooserTask = new PhotoChooserTask();

            photoChooserTask.Show();
        }
Ejemplo n.º 6
0
        public void Init(Ioctls ioctls, Core core, Runtime runtime)
        {
            /**
             * Displays an image picker to the user.
             * It's display depends on the platform.
             * Note: when a selection is made a #EVENT_TYPE_IMAGE_PICKER event is sent.
             */
            ioctls.maImagePickerOpen = delegate()
            {
                mTask = new PhotoChooserTask();
                // a small camera icon will appear in the page application bar - this enables
                // the user to go to the camera and capture another image (which could be selected
                // by using the image picker afterwards)
                mTask.ShowCamera = true;
                mTask.Completed += PhotoChooserTaskCompleted;
                if (!photoTaskStarted)
                {
                    mTask.Show();
                }
                photoTaskStarted = true;

                // we need to keep a reference of the runtime in order to add image resources
                // and send the ImagePicker event
                runtimeReference = runtime;

                return(MoSync.Constants.MAW_RES_OK);
            };
        }
Ejemplo n.º 7
0
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     library = new MediaLibrary();
     photoChooser = new PhotoChooserTask();
     photoChooser.Completed += photoChooser_Completed;
 }
        private void ImagePicker_Click(object sender, RoutedEventArgs e)
        {
            var photoChooserTask = new PhotoChooserTask();

            photoChooserTask.Completed += photoChooserTask_Completed;
            photoChooserTask.Show();
        }
Ejemplo n.º 9
0
 private void btnLibrary_Tapped(object sender, System.Windows.Input.GestureEventArgs e)
 {
     PhotoChooserTask photo = new PhotoChooserTask();
     photo.Completed += photo_Completed;
     photo.ShowCamera = true;
     photo.Show();
 }
Ejemplo n.º 10
0
        private void OpenImage_Click(object sender, RoutedEventArgs e)
        {
            PhotoChooserTask chooser = new PhotoChooserTask();

            chooser.Completed += camera_Completed;
            chooser.Show();
        }
Ejemplo n.º 11
0
        void UploadCommandHandler()
        {
            var task = new PhotoChooserTask();

            task.Show();
            task.Completed += OnTaskOnCompleted;
        }
Ejemplo n.º 12
0
 private void photo_Click(object sender, RoutedEventArgs e)
 {
     PhotoChooserTask ptsk = new PhotoChooserTask();
     ptsk.ShowCamera = true;
     ptsk.Show();
     ptsk.Completed += new EventHandler<PhotoResult>(ptsk_Completed);
 }
 private void upload_Click(object sender, EventArgs e)
 {
     PhotoChooserTask pct = new PhotoChooserTask();
     pct.ShowCamera = true;
     pct.Completed += pct_Completed;
     pct.Show();
 }
 private void btn_Camera_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     PhotoChooserTask pcTask = new PhotoChooserTask();
     pcTask.ShowCamera = true;
     pcTask.Completed += new EventHandler<PhotoResult>(pcTask_Completed);
     pcTask.Show();
 }
Ejemplo n.º 15
0
 private void GetImageFromGallery(object obj)
 {
     PhotoChooserTask photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Show();
     photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
     
 }
Ejemplo n.º 16
0
        private void ChoosePhotoBtn_Click(object sender, RoutedEventArgs e)
        {
            PhotoChooserTask photoTask = new PhotoChooserTask();

            photoTask.Completed += photoTask_Completed;
            photoTask.Show();
        }
 private void photoChooserBtn_Click(object sender, RoutedEventArgs e)
 {
     photoChooserTask = new PhotoChooserTask();
     tag = (sender as Button).Name;
     photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
     photoChooserTask.Show();
 }
Ejemplo n.º 18
0
        //단건 폰사진 추가 이벤트 핸들러
        private void appBarIconBtn_Click(object sender, EventArgs e)
        {
            PhotoChooserTask photoChooserTask = new PhotoChooserTask();

            photoChooserTask.Completed += photoChooserTask_Completed;
            photoChooserTask.Show();
        }
        private void btnGallery_Click(object sender, RoutedEventArgs e)
        {
            var photoChooserTask = new PhotoChooserTask();

            photoChooserTask.Completed += TaskCompletedGallery;
            photoChooserTask.Show();
        }
Ejemplo n.º 20
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            chooser            = new PhotoChooserTask();
            chooser.Completed += new EventHandler <PhotoResult>(chooser_Completed);
        }
        public MovieDetailsPage()
        {
            InitializeComponent();

            photoTask = new PhotoChooserTask();
            photoTask.Completed += new EventHandler<PhotoResult>(photoTask_Completed);
        }
Ejemplo n.º 22
0
        public PhotoChooserCommand(object parameter)
        {
            _photoChooserTask            = new PhotoChooserTask();
            _photoChooserTask.Completed += PhotoChooserTaskOnCompleted;

            _viewModel = (MainViewModel)parameter;
        }
Ejemplo n.º 23
0
        public static void EditPhoto(Action <byte[]> callback)
        {
            var photoChooserTask = new PhotoChooserTask
            {
                ShowCamera  = true,
                PixelHeight = 800,
                PixelWidth  = 800
            };

            photoChooserTask.Completed += (o, e) =>
            {
                if (e.TaskResult == TaskResult.OK)
                {
                    byte[] bytes;
                    var    sourceStream = e.ChosenPhoto;
                    using (var memoryStream = new MemoryStream())
                    {
                        sourceStream.CopyTo(memoryStream);
                        bytes = memoryStream.ToArray();
                    }
                    callback.SafeInvoke(bytes);
                }
            };

            photoChooserTask.Show();
        }
Ejemplo n.º 24
0
        public EnterName()
        {
            InitializeComponent();
            App.WriteToIsoStorageSettings(HikeConstants.FILE_SYSTEM_VERSION, Utils.getAppVersion());// new install so write version
            App.appSettings.Remove(App.ACCOUNT_NAME);
            App.WriteToIsoStorageSettings(App.PAGE_STATE, App.PageState.SETNAME_SCREEN);
            appBar               = new ApplicationBar();
            appBar.Mode          = ApplicationBarMode.Default;
            appBar.Opacity       = 1;
            appBar.IsVisible     = true;
            appBar.IsMenuEnabled = false;

            nextIconButton           = new ApplicationBarIconButton();
            nextIconButton.IconUri   = new Uri("/View/images/icon_tick.png", UriKind.Relative);
            nextIconButton.Text      = AppResources.AppBar_Done_Btn;
            nextIconButton.Click    += new EventHandler(btnEnterName_Click);
            nextIconButton.IsEnabled = false;
            appBar.Buttons.Add(nextIconButton);
            enterName.ApplicationBar = appBar;

            avatarImage.Tap             += OnProfilePicButtonTap;
            photoChooserTask             = new PhotoChooserTask();
            photoChooserTask.ShowCamera  = true;
            photoChooserTask.PixelHeight = HikeConstants.PROFILE_PICS_SIZE;
            photoChooserTask.PixelWidth  = HikeConstants.PROFILE_PICS_SIZE;
            photoChooserTask.Completed  += new EventHandler <PhotoResult>(photoChooserTask_Completed);
        }
Ejemplo n.º 25
0
        public Task<byte[]> PickPhoto()
        {
            var taskCompletionSource = new TaskCompletionSource<byte[]>();
            var task = new PhotoChooserTask();
            task.ShowCamera = false;
            task.PixelWidth = 300;
            task.PixelHeight = 300;
            task.Completed += (s, e) =>
                {
                    if (e.TaskResult == TaskResult.OK && e.ChosenPhoto != null)
                    {
                        using (var ms = new MemoryStream())
                        {
                            e.ChosenPhoto.CopyTo(ms);
                            ms.Position = 0;
                            taskCompletionSource.TrySetResult(ms.ToArray());
                        }
                    }
                    else
                    {
                        taskCompletionSource.TrySetResult(null);
                    }
                };
            task.Show();

            return taskCompletionSource.Task;
        }
Ejemplo n.º 26
0
        public Foto()
        {
            InitializeComponent();

            photoChooserTask = new PhotoChooserTask();
            photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
        }
Ejemplo n.º 27
0
 private void LibraryButtonClick(object sender, EventArgs e)
 {
     var task = new PhotoChooserTask();
     task.Completed += OnPhotoChooserTaskCompleted;
     task.ShowCamera = true;
     task.Show();
 }
        public EditPagePage()
        {
            InitializeComponent();

            _localizedStrings = App.Current.Resources["StringTable"] as StringTable;

            ApplicationBar = new ApplicationBar();
            ApplicationBar.BackgroundColor = (Color)App.Current.Resources["AppbarBackgroundColor"];
            ApplicationBar.ForegroundColor = (Color)App.Current.Resources["WordPressGrey"];

            _saveIconButton        = new ApplicationBarIconButton(new Uri("/Images/appbar.save.png", UriKind.Relative));
            _saveIconButton.Text   = _localizedStrings.ControlsText.Save;
            _saveIconButton.Click += OnSaveButtonClick;
            ApplicationBar.Buttons.Add(_saveIconButton);

            _mediaUploadRPCs = new List <UploadFileRPC>();

            Loaded += OnPageLoaded;

            photoChooserTask            = new PhotoChooserTask();
            photoChooserTask.ShowCamera = true;
            photoChooserTask.Completed += new EventHandler <PhotoResult>(OnChoosePhotoTaskCompleted);

            uploadImagesAsGalleryCheckbox.Visibility = Visibility.Collapsed;
            gallerySettingsButton.Visibility         = Visibility.Collapsed;
        }
Ejemplo n.º 29
0
    private void SelectButton_Click(object sender, RoutedEventArgs e)
    {
        PhotoChooserTask task = new PhotoChooserTask();

        task.Completed += task_Completed;
        task.Show();
    }
Ejemplo n.º 30
0
	    private void OnSendImage(object sender, RoutedEventArgs e)
	    {
            var task = new PhotoChooserTask();
            task.ShowCamera = true;
            task.Completed += async (s, r) =>
            {
                if (r.TaskResult == TaskResult.OK)
                {
                    try
                    {
                        var request = new HttpPostRequest("http://yourdomain.com/Upload");
                        request.ContentType = "multipart/form-data";
                        request.Data.Add("vve", "VvE Naam");                                
                        request.Files.Add(new HttpPostFile("image", "image", r.ChosenPhoto)); 
                        
                        //// TODO: Add pr
                        var response = await Http.PostAsync(request);
                        MessageBox.Show(response.Response);
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message);
                    }
                }
            };
            task.Show();
	    }
Ejemplo n.º 31
0
        public Setting()
        {
            InitializeComponent();
            photoChooserTask = new PhotoChooserTask();
            photoChooserTask.Completed += photoChooserTask_Completed;
            photoChooserTask.ShowCamera = true;

            viewModel = this.DataContext as SettingViewModel;

            // Get the full collection of items:
            //List<CountdownType> allTypes = TypePicker.ItemsSource as List<CountdownType>;

            //int id;
            //if (viewModel.SelectedCountdownType.Name == "Countdown")
            //    id = 0;
            //else
            //    id = 1;

            //TypePicker.SelectedItems = new ObservableCollection<object>() {
            //    allTypes[id]
            //};

            //unitListPicker.SummaryForSelectedItemsDelegate = ViewModelLocator.SummerizeSelection;
            //unitListPicker.SelectionChanged += ViewModelLocator.UnitSelectionFilter;
            //TypePicker.SummaryForSelectedItemsDelegate = SummarizeTypes;
        }
Ejemplo n.º 32
0
        private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
        {
            PhotoChooserTask choose = new PhotoChooserTask();

            choose.Completed += choose_Completed;
            choose.Show();
        }
Ejemplo n.º 33
0
        public MovieDetailsPage()
        {
            InitializeComponent();

            photoTask            = new PhotoChooserTask();
            photoTask.Completed += new EventHandler <PhotoResult>(photoTask_Completed);
        }
Ejemplo n.º 34
0
        private void AlbumButton_Click(object sender, EventArgs e)
        {
            var _photoTask = new PhotoChooserTask();

            _photoTask.Completed += OnCameraAlbumTaskOnCompleted;
            _photoTask.Show();
        }
Ejemplo n.º 35
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            PhotoChooserTask choose = new PhotoChooserTask();

            choose.Completed += choose_Completed;
            choose.Show();
        }
 private void Choose_Click(object sender, EventArgs e)
 {
    var task = new PhotoChooserTask();
    task.ShowCamera = true;
    task.Completed += chooserTask_Completed;
    task.Show();
 }
Ejemplo n.º 37
0
        private void Add_Click(object sender, EventArgs e)
        {
            var pc = new PhotoChooserTask();

            pc.Completed += pc_Completed;
            pc.Show();
        }
Ejemplo n.º 38
0
 public MainPage()
 {
     InitializeComponent();
     this.choosePhotoTask = CreateChooseImageTask();
     this.downSampler = new DownSampler(8);
     this.noiseReducer = new NoiseReducer();
 }
Ejemplo n.º 39
0
        public PhotoChooserCommand(object parameter)
        {
            _photoChooserTask = new PhotoChooserTask();
            _photoChooserTask.Completed += PhotoChooserTaskOnCompleted;

            _viewModel = (MainViewModel) parameter;
        }
Ejemplo n.º 40
0
        // Konstruktor
        public MainPage()
        {
            InitializeComponent();

            _resetTextAction = new DelayAction(800, () => { DisplayResult(null); barCodeBorder.Child = null; });

            // prepare Photo Chooser Task for the open button
            photoChooserTask            = new PhotoChooserTask();
            photoChooserTask.Completed += (s, e) => { if (e.TaskResult == TaskResult.OK)
                                                      {
                                                          ProcessImage(e);
                                                      }
            };

            // prepare the backround worker thread for the image processing
            scannerWorker                     = new BackgroundWorker();
            scannerWorker.DoWork             += scannerWorker_DoWork;
            scannerWorker.RunWorkerCompleted += scannerWorker_RunWorkerCompleted;

            foreach (var x in typeof(BarcodeFormat).GetFields())
            {
                if (x.IsLiteral)
                {
                    BarcodeType.Items.Add(x.GetValue(null));
                }
            }

            // open the default barcode which should be displayed when the app starts
            var uri       = new Uri("/images/35.png", UriKind.Relative);
            var imgSource = new BitmapImage(uri);

            BarcodeImage.Source    = imgSource;
            imgSource.ImageOpened += (s, e) => scannerWorker.RunWorkerAsync(new WriteableBitmap((BitmapImage)s));
        }
Ejemplo n.º 41
0
        public MainPage()
        {
            InitializeComponent();
            photoChooserTask = new PhotoChooserTask();
            photoChooserTask.Completed += PhotoChooserTaskCompleted;

        }
Ejemplo n.º 42
0
        private void Browse_Clicked(object sender, RoutedEventArgs e)
        {
            PhotoChooserTask task = new PhotoChooserTask();

            task.Show();
            task.Completed += task_Completed;
        }
Ejemplo n.º 43
0
        public void Show(Action <Photo> photoSelectedAction, Action photoNotSelectedAction, Action <Exception> errorAction)
        {
            try {
                var task = new PhotoChooserTask();
                task.ShowCamera = true;
                if (Height > 0)
                {
                    task.PixelHeight = Height;
                }
                if (Width > 0)
                {
                    task.PixelWidth = Width;
                }

                task.Completed += (sender, result) => {
                    if (result.TaskResult != TaskResult.OK)
                    {
                        photoNotSelectedAction.Invoke();
                        return;
                    }
                    photoSelectedAction.Invoke(new Photo(result.OriginalFileName, result.ChosenPhoto));
                };
                task.Show();
            }
            catch (Exception ex) {
                errorAction.Invoke(ex);
            }
        }
Ejemplo n.º 44
0
        //---------------------------------------------------------------------------------------------------------



        //Wird am Anfang ausgeführt
        //---------------------------------------------------------------------------------------------------------
        public EditFolder()
        {
            //Komponenten laden
            InitializeComponent();

            //AppBar erstellen
            AppBar01();

            //PhotoCooser Task
            photoChooserTask = new PhotoChooserTask();
            //Angeben was PhotoCooserTask ausführt wenn Bild ausgewählt
            photoChooserTask.Completed += new EventHandler <PhotoResult>(photoChooserTask_Completed);

            //png Encoder undpng Decoder erstellen
            ImageTools.IO.Decoders.AddDecoder <PngDecoder>();
            ImageTools.IO.Encoders.AddEncoder <PngEncoder>();

            //Bilder ändern
            Color  backgroundColor = (Color)Application.Current.Resources["PhoneBackgroundColor"];
            string temp            = Convert.ToString(backgroundColor);

            if (temp != "#FF000000")
            {
                ImgTop.Source   = new BitmapImage(new Uri("Images/Folder.Light.png", UriKind.Relative));
                ImgTop.Opacity  = 0.1;
                ImgTop2.Source  = new BitmapImage(new Uri("Images/Copy.Light.png", UriKind.Relative));
                ImgTop2.Opacity = 0.1;
                ImgTop3.Source  = new BitmapImage(new Uri("Images/Cut.Light.png", UriKind.Relative));
                ImgTop3.Opacity = 0.1;
            }
        }
        public EditPagePage()
        {
            InitializeComponent();

            _localizedStrings = App.Current.Resources["StringTable"] as StringTable;

            ApplicationBar = new ApplicationBar();
            ApplicationBar.BackgroundColor = (Color)App.Current.Resources["AppbarBackgroundColor"];
            ApplicationBar.ForegroundColor = (Color)App.Current.Resources["WordPressGrey"];

            _saveIconButton = new ApplicationBarIconButton(new Uri("/Images/appbar.save.png", UriKind.Relative));
            _saveIconButton.Text = _localizedStrings.ControlsText.Save;
            _saveIconButton.Click += OnSaveButtonClick;
            ApplicationBar.Buttons.Add(_saveIconButton);

            _mediaUploadRPCs = new List<UploadFileRPC>();

            Loaded += OnPageLoaded;

            photoChooserTask = new PhotoChooserTask();
            photoChooserTask.ShowCamera = true;
            photoChooserTask.Completed += new EventHandler<PhotoResult>(OnChoosePhotoTaskCompleted);

            uploadImagesAsGalleryCheckbox.Visibility = Visibility.Collapsed;
            gallerySettingsButton.Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 46
0
 /// <summary>
 /// select photo
 /// </summary>
 public void SelectPhoto()
 {
     PhotoChooserTask photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Completed += SelectPictureComplete;
     photoChooserTask.ShowCamera = true;
     photoChooserTask.Show();
 }
Ejemplo n.º 47
0
        private void galeria_Click(object sender, EventArgs e)
        {
            PhotoChooserTask chooser = new PhotoChooserTask();

            chooser.Completed += PickImageCallback;
            chooser.Show();
        }
Ejemplo n.º 48
0
        private void OnSendImage(object sender, RoutedEventArgs e)
        {
            var task = new PhotoChooserTask();

            task.ShowCamera = true;
            task.Completed += async(s, r) =>
            {
                if (r.TaskResult == TaskResult.OK)
                {
                    try
                    {
                        var request = new HttpPostRequest("http://yourdomain.com/Upload");
                        request.ContentType = "multipart/form-data";
                        request.Data.Add("vve", "VvE Naam");
                        request.Files.Add(new HttpPostFile("image", "image", r.ChosenPhoto));

                        //// TODO: Add pr
                        var response = await Http.PostAsync(request);

                        MessageBox.Show(response.Response);
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message);
                    }
                }
            };
            task.Show();
        }
Ejemplo n.º 49
0
      // Konstruktor
      public MainPage()
      {
         InitializeComponent();

         // prepare Photo Chooser Task for the open button
         photoChooserTask = new PhotoChooserTask();
         photoChooserTask.Completed += (s, e) => { if (e.TaskResult == TaskResult.OK) ProcessImage(e); };

         // prepare the backround worker thread for the image processing
         scannerWorker = new BackgroundWorker();
         scannerWorker.DoWork += scannerWorker_DoWork;
         scannerWorker.RunWorkerCompleted += scannerWorker_RunWorkerCompleted;

         foreach (var x in typeof(BarcodeFormat).GetFields())
         {
            if (x.IsLiteral)
            {
               BarcodeType.Items.Add(x.GetValue(null));
            }
         }

         // open the default barcode which should be displayed when the app starts
         var uri = new Uri("/images/35.png", UriKind.Relative);
         var imgSource = new BitmapImage(uri);
         BarcodeImage.Source = imgSource;
         imgSource.ImageOpened += (s, e) => scannerWorker.RunWorkerAsync(new WriteableBitmap((BitmapImage)s));
      }
Ejemplo n.º 50
0
 public void ChoosePictureFromLibrary(int maxPixelDimension, int percentQuality, Action<Stream> pictureAvailable,
                                      Action assumeCancelled)
 {
     // note - do not set PixelHeight = maxPixelDimension, PixelWidth = maxPixelDimension here - as that would create square cropping
     var chooser = new PhotoChooserTask {ShowCamera = false};
     ChoosePictureCommon(chooser, maxPixelDimension, percentQuality, pictureAvailable, assumeCancelled);
 }
        private  void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PhotoChooserTask task = new PhotoChooserTask();
                task.Completed += async (s, res) =>
                {
                    if (res.TaskResult == TaskResult.OK)
                    {
                       

                       using( var source  = new StreamImageSource(res.ChosenPhoto))
                        using(var renderer = new BitmapRenderer(source,input))
                        {
                            await renderer.RenderAsync();
                        }
                        if(manager != null)
                        {
                            manager.Dispose();
                            manager = null;
                        }
                        manager = new PipelineManager.Manager.PipelineManager(picture);
                        GeneratePicture();
                    }

                };
                task.Show();
            }
            catch (Exception)
            {


            }
        }
Ejemplo n.º 52
0
 private void UploadUserPictureButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     photoChooserTask            = new PhotoChooserTask();
     photoChooserTask.ShowCamera = true;
     photoChooserTask.Completed += OnPhotoChooserTask_Completed;
     photoChooserTask.Show();
 }
Ejemplo n.º 53
0
 public EditParameters()
 {
     InitializeComponent();
     photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Completed += photoChooserTask_Completed;
     foo();
 }
Ejemplo n.º 54
0
        public CartoonPreviewPage()
        {
            InitializeComponent();

            this.loadImageOnLayoutUpdate = true;
            this.loadImageCancelled      = false;
            this.pageNavigationComplete  = false;
            this.restartCartoonGenerator = false;
            this.gaussianRadius          = (int)this.GaussianRadiusSlider.Value;
            this.cartoonThreshold        = (int)this.ThresholdSlider.Value;
            this.loadedBitmap            = null;
            this.scaledBitmap            = null;
            this.previewBitmap           = null;

            this.cartoonGeneratorWorker                     = new BackgroundWorker();
            this.cartoonGeneratorWorker.DoWork             += new DoWorkEventHandler(cartoonGeneratorWorker_DoWork);
            this.cartoonGeneratorWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(cartoonGeneratorWorker_RunWorkerCompleted);

            this.photoChooserTask            = new PhotoChooserTask();
            this.photoChooserTask.ShowCamera = true;
            this.photoChooserTask.Completed += new EventHandler <PhotoResult>(photoChooserTask_Completed);

            ApplicationBarIconButton button;

            button        = new ApplicationBarIconButton(new Uri("/Images/help.png", UriKind.Relative));
            button.Text   = AppResources.ApplicationBarButtonHelpText;
            button.Click += new EventHandler(HelpButton_Click);

            this.ApplicationBar.Buttons.Add(button);
        }
Ejemplo n.º 55
0
        //DateTime lastTouchUpdate;
        public PicEffect()
        {
            InitializeComponent();

            // Init vars
            oldViewportSize = new Size(Viewport.ActualWidth, Viewport.ActualHeight);
            wasResized = false;

            // Attach touch event handler
            Touch.FrameReported += Touch_FrameReported;

            // Init tasks
            cameraCaptureTask = new CameraCaptureTask();
            cameraCaptureTask.Completed += PhotoProviderTaskCompleted;
            photoChooserTask = new PhotoChooserTask();
            photoChooserTask.Completed += PhotoProviderTaskCompleted;

            // Disable the camera button if the app runs in the emulator
            // Todo: The BtnCamera reference returns null in WP7 v1
            // BtnCamera.IsEnabled = Microsoft.Devices.Environment.DeviceType != DeviceType.Emulator;
            // That's why we have to use this more hacky trick:
            var buttons = ApplicationBar.Buttons.Cast<Microsoft.Phone.Shell.ApplicationBarIconButton>();
            var btn = buttons.Where(b => b.IconUri.ToString().ToLower().Contains("camera")).FirstOrDefault();
            //if (btn != null)
            //{
                //btn.IsEnabled = Microsoft.Devices.Environment.DeviceType != DeviceType.Emulator;
            //}
            BackKeyPress += OnBackKeyPressed;
        }
Ejemplo n.º 56
0
 private void btnCopyExistingPhoto_Click(object sender, RoutedEventArgs e)
 {
     // Start the photo chooser task.
     photoChooserTask            = new PhotoChooserTask();
     photoChooserTask.Completed += new EventHandler <PhotoResult>(photoChooserTask_Completed);
     photoChooserTask.Show();
 }
 public PostAPhoto()
 {
     InitializeComponent();
     photoChooserTask = new PhotoChooserTask();
     photoChooserTask.ShowCamera = true;
     photoChooserTask.Completed += photoChooserTask_Completed;
     this.Loaded += PostAPhoto_Loaded;
 }
 public MainPage()
 {
     InitializeComponent();
     this.photoChooserTask = new PhotoChooserTask();
     this.photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
     this.photoCameraCapture = new CameraCaptureTask();
     this.photoCameraCapture.Completed += new EventHandler<PhotoResult>(photoCameraCapture_Completed);
 }
        private void PickImage_Click(object sender, RoutedEventArgs e)
        {
            SaveButton.IsEnabled = false;

            PhotoChooserTask chooser = new PhotoChooserTask();
            chooser.Completed += PickImageCallback;
            chooser.Show();
        }
 private void ChangeProfilePictureButton_Click(object sender, RoutedEventArgs e)
 {
     PhotoChooserTask photoChooserTask;
     photoChooserTask = new PhotoChooserTask();
     var bitmapimage = new BitmapImage();
     photoChooserTask.Completed += photoChooserTask_Completed;
     photoChooserTask.Show();
 }