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 GetImageFromGallery(object obj)
 {
     PhotoChooserTask photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Show();
     photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
     
 }
 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();
 }
 private void LibraryButtonClick(object sender, EventArgs e)
 {
     var task = new PhotoChooserTask();
     task.Completed += OnPhotoChooserTaskCompleted;
     task.ShowCamera = true;
     task.Show();
 }
 private void upload_Click(object sender, EventArgs e)
 {
     PhotoChooserTask pct = new PhotoChooserTask();
     pct.ShowCamera = true;
     pct.Completed += pct_Completed;
     pct.Show();
 }
Example #6
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();
	    }
Example #7
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);
 }
        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;
        }
 /// <summary>
 /// select photo
 /// </summary>
 public void SelectPhoto()
 {
     PhotoChooserTask photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Completed += SelectPictureComplete;
     photoChooserTask.ShowCamera = true;
     photoChooserTask.Show();
 }
Example #10
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;
        }
        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)
                {
                }
        }
 private void Choose_Click(object sender, EventArgs e)
 {
    var task = new PhotoChooserTask();
    task.ShowCamera = true;
    task.Completed += chooserTask_Completed;
    task.Show();
 }
 private void btnLibrary_Tapped(object sender, System.Windows.Input.GestureEventArgs e)
 {
     PhotoChooserTask photo = new PhotoChooserTask();
     photo.Completed += photo_Completed;
     photo.ShowCamera = true;
     photo.Show();
 }
 private void ChangeProfilePictureButton_Click(object sender, RoutedEventArgs e)
 {
     PhotoChooserTask photoChooserTask;
     photoChooserTask = new PhotoChooserTask();
     var bitmapimage = new BitmapImage();
     photoChooserTask.Completed += photoChooserTask_Completed;
     photoChooserTask.Show();
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     _temp = (sender as Button).DataContext as Repair;
     PhotoChooserTask photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Completed += photoChooserTask2_Completed;
     photoChooserTask.ShowCamera = true;
     photoChooserTask.Show();
 }
Example #16
0
        public MainPage()
        {
            InitializeComponent();

            PhotoChooserTask task = new PhotoChooserTask();
            task.Show();
            task.Completed += new EventHandler<PhotoResult>(task_Completed);
        }
        private void PickImage_Click(object sender, RoutedEventArgs e)
        {
            SaveButton.IsEnabled = false;

            PhotoChooserTask chooser = new PhotoChooserTask();
            chooser.Completed += PickImageCallback;
            chooser.Show();
        }
Example #18
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     PhotoChooserTask photoChooserTask = new PhotoChooserTask();
     photoChooserTask.PixelHeight = 400;
     photoChooserTask.PixelWidth = 200;
     photoChooserTask.Completed += photoChooserTask_Completed;
     photoChooserTask.Show();
 }
Example #19
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     var photoChooser = new PhotoChooserTask();
     photoChooser.PixelHeight = 170;
     photoChooser.PixelWidth = 170;
     photoChooser.Completed += photoChooser_Completed;
     photoChooser.Show();
 }
Example #20
0
 //Save the existing image of media library into isolated storage
 private void Save_the_existing_image_click(object sender, RoutedEventArgs e)
 {
     PhotoChooserTask task = new PhotoChooserTask();
     task.PixelWidth = 300;
     task.PixelHeight = 300;
     task.Completed += task_Completed;
     task.ShowCamera = true;
     task.Show();
 }
 private void rootBorder_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     PhotoChooserTask photoChooser = new PhotoChooserTask();
     photoChooser.PixelHeight = 300;
     photoChooser.PixelWidth = 300;
     photoChooser.ShowCamera = true;
     photoChooser.Completed += photoChooser_Completed;
     photoChooser.Show();
 }
Example #22
0
 void Page1_Loaded(object sender, RoutedEventArgs e)
 {
     if (!photoLoaded)
     {
         PhotoChooserTask task = new PhotoChooserTask();
         task.Completed += new EventHandler<PhotoResult>(task_Completed);
         task.Show();
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     PhotoChooserTask chooser = new PhotoChooserTask();
     chooser.Completed += chooser_Completed;
     var cont = Application.Current.Host.Content;
     chooser.PixelHeight = (int)Math.Ceiling(cont.ActualHeight * cont.ScaleFactor / 100.0);
     chooser.PixelWidth = (int)Math.Ceiling(cont.ActualWidth * cont.ScaleFactor / 100.0);
     chooser.Show();
 }
Example #24
0
 private void btn_DIY_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     btn_DIY.Width = 150;
     btn_DIY.Height = 150;
     PhotoChooserTask pcTask = new PhotoChooserTask();
     pcTask.ShowCamera = true;
     pcTask.Completed += new EventHandler<PhotoResult>(pcTask_Completed);
     pcTask.Show();
 }
 private void btnChoosePhoto_Click(object sender, RoutedEventArgs e)
 {
     PhotoChooserTask photoChooser = new PhotoChooserTask();
     photoChooser.Completed += (o, args) =>
                                   {
                                       _imgStream = args.ChosenPhoto;
                                   };
     photoChooser.Show();
 }
Example #26
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     // Create a new PhotoChooser task
     PhotoChooserTask photoChooser = new PhotoChooserTask();
     // Add an event handler for when it has completed
     photoChooser.Completed += photoChooser_Completed;
     // Show our PhotoChooserTask
     photoChooser.Show();
 }
 private void Grid_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     PhotoChooserTask photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Completed += photoChooserTask_Completed;
     photoChooserTask.ShowCamera = true;
     photoChooserTask.PixelHeight = 480;
     photoChooserTask.PixelWidth = 700;
     photoChooserTask.Show();
 }
Example #28
0
 private void SalvaImagemExistente(object sender, RoutedEventArgs e)
 {
     PhotoChooserTask task = new PhotoChooserTask();
     task.PixelWidth = 300;
     task.PixelHeight = 300;
     task.Completed += task_Completed;
     task.ShowCamera = true;
     task.Show();
 }
Example #29
0
        private void NewChallenge_Click(object sender, EventArgs e)
        {
            var photoTask = new PhotoChooserTask();
            photoTask.PixelHeight = 480;
            photoTask.PixelWidth = 480;
            photoTask.ShowCamera = true;
            photoTask.Completed += Complete_PhotoChooserTask;

            photoTask.Show();
        }
 private void ChooseFromPhoneClick(object sender, RoutedEventArgs e)
 {
     var task = new PhotoChooserTask {
         PixelHeight = 200,
         PixelWidth = 200,
         ShowCamera = true
     };
     task.Completed += PhotoChosen;
     task.Show();
 }
Example #31
0
 private void btnSlelectMotorPlate_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     photoChooserTask            = new PhotoChooserTask();
     photoChooserTask.Completed += new EventHandler <PhotoResult>(photoLicensePlateChooserTask_Completed);
     photoChooserTask.Show();
 }
Example #32
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     photoChooserTask.Show();
 }
Example #33
0
 /// <summary>
 /// menubar button uplaod click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Upload_Click(object sender, EventArgs e)
 {
     photoChooserTask.Show();
 }
Example #34
0
 private void uploadClick(object sender, RoutedEventArgs e)
 {
     photoChooserTask.Show();
 }
Example #35
0
 private void GalleryButton_Click(object sender, EventArgs e)
 {
     _photoChooserTask.Show();
 }
Example #36
0
 private void OpenButton_Click(object sender, EventArgs e)
 {
     _task.Show();
 }
Example #37
0
 private void ButtonGaleryImage_Click(object sender, RoutedEventArgs e)
 {
     photoTask.Show();
 }
 /// <summary>
 /// Code to execute when user clicks on ChooseFile button to add an attachment to the list item
 /// </summary>
 private void OnChooseFileButtonClick(object sender, RoutedEventArgs e)
 {
     photoChooser.Show();
 }
Example #39
0
 void OnAppbarLoadClick(object sender, EventArgs args)
 {
     appbarSaveButton.IsEnabled = false;
     photoChooser.Show();
 }
Example #40
0
 private void Button_Click_5(object sender, RoutedEventArgs e)
 {
     photoChooserTask            = new PhotoChooserTask();
     photoChooserTask.Completed += new EventHandler <PhotoResult>(photoChooserTask_Completed);
     photoChooserTask.Show();
 }
Example #41
0
 private void fromFile_Click(object sender, RoutedEventArgs e)
 {
     photoChooserTask.Show();
 }
        private async void loadFileDialogAsync(FolderLocations folderLocation, int maxWidth, int maxHeight, string[] fileTypes, StreamLoadedCallbackMethod streamLoadedCallback)
                #endif
        {
                        #if WINDOWS_PHONE
            WinRTPlugin.Dispatcher.BeginInvoke(async delegate()
                        #elif UNITY_WP_8_1
            await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
                        #else
            await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async delegate()
                        #endif
            {
                Stream stream = null;
                try
                {
                                        #if WINDOWS_PHONE
                    if (folderLocation == FolderLocations.Pictures)
                    {
                        photoChooser            = new PhotoChooserTask();
                        photoChooser.ShowCamera = false;
                        photoChooser.Completed += photoChooserTask_Completed;
                        photoChooserTask_StreamLoadedCallback = streamLoadedCallback;
                        photoChooserTask_fileTypes            = fileTypes;
                        photoChooserTask_maxWidth             = maxWidth;
                        photoChooserTask_maxHeight            = maxHeight;
                        photoChooser.Show();
                        return;
                    }
                                        #endif

                    var picker = new FileOpenPicker();
                    if (fileTypes != null)
                    {
                        foreach (var fileType in fileTypes)
                        {
                            picker.FileTypeFilter.Add(fileType);
                        }
                    }

                    picker.SuggestedStartLocation = getFolderType(folderLocation);
                                        #if UNITY_WP_8_1
                    LoadFileDialog_picker = picker;
                    LoadFileDialog_streamLoadedCallback = streamLoadedCallback;
                    LoadFileDialog_maxWidth             = maxWidth;
                    LoadFileDialog_maxHeight            = maxHeight;
                    picker.PickSingleFileAndContinue();
                                        #else
                    var file = await picker.PickSingleFileAsync();
                    if (file != null)
                    {
                        if (maxWidth == 0 || maxHeight == 0)
                        {
                            stream = await file.OpenStreamForReadAsync();
                            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
                            {
                                streamLoadedCallback(stream, true);
                            }, false);
                        }
                        else
                        {
                                                        #if UNITY_METRO
                            using (var tempStream = await file.OpenStreamForReadAsync())
                            {
                                                                #if UNITY_METRO_8_0
                                using (var outputStream = new MemoryStream().AsOutputStream())
                                {
                                    await RandomAccessStream.CopyAsync(tempStream.AsInputStream(), outputStream);
                                    stream = await resizeImageStream((IRandomAccessStream)outputStream, maxWidth, maxHeight);
                                }
                                                                #else
                                stream = await resizeImageStream(tempStream.AsRandomAccessStream(), maxWidth, maxHeight);
                                                                #endif
                            }

                            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
                            {
                                streamLoadedCallback(stream, true);
                            }, false);
                                                        #endif
                        }
                    }
                    else
                    {
                        UnityEngine.WSA.Application.InvokeOnAppThread(() =>
                        {
                            streamLoadedCallback(null, false);
                        }, false);
                    }
                                        #endif
                }
                catch (Exception e)
                {
                    if (stream != null)
                    {
                        stream.Dispose();
                    }
                    Debug.LogError(e.Message);
                    UnityEngine.WSA.Application.InvokeOnAppThread(() =>
                    {
                        streamLoadedCallback(null, false);
                    }, false);
                }
            });
        }
Example #43
0
 private void btnOpenPhoto_Click(object sender, EventArgs e)
 {
     photoChooserTask.Show();
 }
Example #44
0
 private void OnChoosePhotoBtnClick(object sender, RoutedEventArgs e)
 {
     SetPhotoChooser(photoChooser, false);
     photoChooser.Show();
 }
Example #45
0
 public void AddImage(object arg)
 {
     _photoChooser.Show();
 }
Example #46
0
 private void ChoosePicture_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
 {
     _photoChooser.Show();
 }
Example #47
0
 private void BtnGallery_Click(object sender, RoutedEventArgs e)
 {
     // show photochooser
     pct.Show();
     pct.Completed += new EventHandler <PhotoResult>(pct_Completed);
 }
        /// <summary>
        /// Add a finalizer to check for memory leaks
        /// </summary>
        //~ChooseBackgroundViewModel()
        //{
        //    TLUtils.WritePerformance("++ChooseBackgroundViewModel dstr");
        //}
#endif

        public void Choose(BackgroundItem item)
        {
            if (item == null)
            {
                return;
            }

            if (item == _libraryBackground)
            {
                var task = new PhotoChooserTask
                {
                    PixelHeight = 800,
                    PixelWidth  = 480,
                    ShowCamera  = true
                };
                task.Completed += (sender, result) =>
                {
                    if (result.TaskResult != TaskResult.OK)
                    {
                        return;
                    }

                    byte[] bytes;
                    var    sourceStream = result.ChosenPhoto;
                    var    fileName     = Path.GetFileName(result.OriginalFileName);

                    if (string.IsNullOrEmpty(fileName))
                    {
                        return;
                    }

                    using (var memoryStream = new MemoryStream())
                    {
                        sourceStream.CopyTo(memoryStream);
                        bytes = memoryStream.ToArray();
                    }

                    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        using (var file = store.OpenFile(fileName, FileMode.CreateNew))
                        {
                            file.Write(bytes, 0, bytes.Length);
                        }
                    }

                    _libraryBackground.IsoFileName = fileName;

                    ReplaceBackgroundItem(_libraryBackground);
                };
                task.Show();

                return;
            }

            if (item == AnimatedBackground1)
            {
                MessageBox.Show(AppResources.PleaseNoteThatAnimatedBackgroundConsumesMoreBatteryResources);
            }

            ReplaceBackgroundItem(item);
        }
Example #49
0
 private void SelectPictureButton_OnTap(object sender, GestureEventArgs e)
 {
     photoChooserTask.Show();
 }
Example #50
0
 /// <summary>
 /// Permet de sélectionner une photo dans la galerie
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BoutonSelectPhotoTap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     _galerie.Show();
 }
Example #51
0
 private void AddImageButton_Click(object sender, RoutedEventArgs e)
 {
     photoChooser.Show();
 }
Example #52
0
 private void btnLoad_Click(object sender, RoutedEventArgs e)
 {
     chooser.Show();
 }
Example #53
0
 private void BotonCambiarImagen_Click(object sender, RoutedEventArgs e)
 {
     photoChooserTask.Show();
 }
 private void OnChoosePhoto(object sender, EventArgs e)
 {
     _photoChooserTask.Show();
 }
Example #55
0
 private void btnPickFromPictures_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     _photoChooserTask.Show();
 }
Example #56
0
 private void Choosebtn_Click(object sender, RoutedEventArgs e)
 {
     phototask.Show();
 }
Example #57
0
        public static void EditPhoto(Action <byte[]> callback)
        {
            var photoPickerSettings = IoC.Get <IStateService>().GetPhotoPickerSettings();

            if (photoPickerSettings != null && photoPickerSettings.External)
            {
                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();
            }
            else
            {
                ChooseAttachmentViewModel.OpenPhotoPicker(true, (result1, result2) =>
                {
                    Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.4), () =>
                    {
                        var frame = Application.Current.RootVisual as PhoneApplicationFrame;
                        PhoneApplicationPage page = null;
                        if (frame != null)
                        {
                            page = frame.Content as PhoneApplicationPage;
                            if (page != null)
                            {
                                var applicationBar = page.ApplicationBar;
                                if (applicationBar != null)
                                {
                                    applicationBar.IsVisible = false;
                                }
                            }
                        }

                        if (page == null)
                        {
                            return;
                        }

                        var popup       = new Popup();
                        var cropControl = new CropControl
                        {
                            Width  = page.ActualWidth,
                            Height = page.ActualHeight
                        };
                        _cropControl      = cropControl;
                        page.SizeChanged += PageOnSizeChanged;

                        cropControl.Close += (sender, args) =>
                        {
                            _cropControl = null;
                            popup.IsOpen = false;
                            popup.Child  = null;

                            frame = Application.Current.RootVisual as PhoneApplicationFrame;
                            if (frame != null)
                            {
                                page = frame.Content as PhoneApplicationPage;
                                if (page != null)
                                {
                                    page.SizeChanged  -= PageOnSizeChanged;
                                    var applicationBar = page.ApplicationBar;
                                    if (applicationBar != null)
                                    {
                                        applicationBar.IsVisible = true;
                                    }
                                }
                            }
                        };
                        cropControl.Crop += (sender, args) =>
                        {
                            callback.SafeInvoke(args.File);

                            cropControl.TryClose();
                        };
                        cropControl.SetFile(result1.FirstOrDefault(), result2.FirstOrDefault());

                        popup.Child  = cropControl;
                        popup.IsOpen = true;
                    });
                });
            }
        }
Example #58
0
 private void btnSelectMotorInsuranceImg_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     photoChooserTask            = new PhotoChooserTask();
     photoChooserTask.Completed += new EventHandler <PhotoResult>(photoMotorInsuranceChooserTask_Completed);
     photoChooserTask.Show();
 }
Example #59
0
        public UserModel()
            : base("User")
        {
            User = null;
            GenericCanExecute = (obj) => User != null && DataTransfer.CurrentAccount != null;

            followUser = new DelegateCommand((obj) =>
            {
                IsLoading = true;
                ServiceDispatcher.GetService(DataTransfer.CurrentAccount).FollowUser(new FollowUserOptions {
                    UserId = User.Id
                }, ReceiveFollow);
            }, x => FriendshipRetrieved && GenericCanExecute.Invoke(null));

            unfollowUser = new DelegateCommand((obj) =>
            {
                IsLoading = true;
                ServiceDispatcher.GetService(DataTransfer.CurrentAccount).UnfollowUser(new UnfollowUserOptions {
                    UserId = User.Id
                }, ReceiveFollow);
            }, x => FriendshipRetrieved && GenericCanExecute.Invoke(null));

            pinUser = new DelegateCommand((obj) =>
            {
                Config.Columns.Add(new TwitterResource
                {
                    Data = User.ScreenName,
                    Type = ResourceType.Tweets,
                    User = DataTransfer.CurrentAccount
                });
                Config.SaveColumns();
                MessageService.ShowLightNotification(Resources.UserPinned);
                pinUser.RaiseCanExecuteChanged();
            }, item => GenericCanExecute.Invoke(null) &&
                                          !Config.Columns.Any(o => o.Type == ResourceType.Tweets && o.Data == User.ScreenName));

            block = new DelegateCommand((obj) =>
            {
                IsLoading = true;
                ServiceDispatcher.GetService(DataTransfer.CurrentAccount).BlockUser(new BlockUserOptions {
                    UserId = User.Id
                }, ReceiveBlock);
            }, obj => GenericCanExecute(obj) && DataTransfer.CurrentAccount.ScreenName != User.ScreenName);

            unblock = new DelegateCommand((obj) =>
            {
                IsLoading = true;
                ServiceDispatcher.GetService(DataTransfer.CurrentAccount).UnblockUser(new UnblockUserOptions {
                    UserId = User.Id
                }, ReceiveBlock);
            }, obj => GenericCanExecute(obj) && DataTransfer.CurrentAccount.ScreenName != User.ScreenName);

            reportSpam = new DelegateCommand((obj) =>
            {
                IsLoading = true;
                ServiceDispatcher.GetService(DataTransfer.CurrentAccount).ReportSpam(new ReportSpamOptions {
                    UserId = User.Id
                }, ReceiveReportSpam);
            }, obj => GenericCanExecute(obj) && DataTransfer.CurrentAccount.ScreenName != User.ScreenName);

            changeAvatar = new DelegateCommand((obj) =>
            {
                PhotoChooserTask task = new PhotoChooserTask();
                task.ShowCamera       = true;
                task.Completed       += new EventHandler <PhotoResult>(task_Completed);
                task.Show();
            }, (obj) => GenericCanExecute.Invoke(null) && IsOwner);

            navigateTo = new DelegateCommand((url) =>
            {
                var task = new WebBrowserTask();
                task.Uri = new Uri((string)url, UriKind.Absolute);
                task.Show();
            }, (url) => url is string && Uri.IsWellFormedUriString(url as string, UriKind.Absolute));

            manageLists = new DelegateCommand((obj) => Navigate("/Pages/Lists/ListManager.xaml?user="******"FollowsMe")
                {
                    UpdateRelationshipText();
                }
                if (e.PropertyName == "ScreenName")
                {
                    UpdateRelationshipText();
                }
            };
        }
Example #60
0
 private void Boton1_Click(object sender, RoutedEventArgs e)
 {
     botonPulsado = 1;
     photoChooserTask.Show();
 }