Esempio n. 1
0
        public void Create()
        {
            RefreshBindingScope.Scope();
            if (this.Validator.HasErrors)
            {
                return;
            }

            IsBusy = true;
            try
            {
                PhotoServiceClient svc = new PhotoServiceClient();
                Album album            = new Album();
                album.Name = Name;
                svc.CreateAlbumCompleted += (sender, e) =>
                {
                    IsBusy = false;
                    if (e.Error != null)
                    {
                        e.Error.Handle();
                    }
                    if (CreateCompleted != null)
                    {
                        CreateCompleted(this, new AsyncOperationCompletedEventArgs(e.Error));
                    }
                };
                svc.CreateAlbumAsync(album);
            }
            catch
            {
                IsBusy = false;
            }
        }
Esempio n. 2
0
        public void Create()
        {
            RefreshBindingScope.Scope();
            if (this.Validator.HasErrors)
                return;

            IsBusy = true;
            try
            {
                PhotoServiceClient svc = new PhotoServiceClient();
                Album album = new Album();
                album.Name = Name;
                svc.CreateAlbumCompleted += (sender, e) =>
                {
                    IsBusy = false;
                    if (e.Error != null)
                    {
                        e.Error.Handle();
                    }
                    if (CreateCompleted != null)
                        CreateCompleted(this, new AsyncOperationCompletedEventArgs(e.Error));
                };
                svc.CreateAlbumAsync(album);
            }
            catch
            {
                IsBusy = false;
            }
        }