void commodityPluCodes_LoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                // Handling for a paged data feed.
                if (commodityPluCodes.Continuation != null)
                {
                    // Automatically load the next page.
                    commodityPluCodes.LoadNextPartialSetAsync();
                }
                else
                {
                    // Set the data context of the list box control to the sample data.
                    this.LayoutRoot.DataContext = commodityPluCodes;
                }

                if (commodityPluCodes.Count < 1)
                {
                    ItemNotFound();
                }
            }
            else
            {
                MessageBox.Show(string.Format("An error has occurred: {0}", e.Error.Message));
                ItemNotFound();
                
            }

            ProgressBar.HideProgress(this);
        }
Example #2
0
 void Photos_LoadCompleted(object sender, System.Data.Services.Client.LoadCompletedEventArgs e)
 {
     // Hide the progress bar and unregister for the event.
     this.requestProgress.Visibility      = Visibility.Collapsed;
     this.requestProgress.IsIndeterminate = false;
     App.ViewModel.Photos.LoadCompleted  -= this.Photos_LoadCompleted;
 }
		//This is akin to ServiceConnected in Android Map2DOnline
		private static void buildings_LoadCompleted(object sender, LoadCompletedEventArgs e)
		{
            if (e.Error == null)
			{
				// Handling for a paged data feed.
				if (buildings.Continuation != null)
				{
					// Automatically load the next page.
					buildings.LoadNextPartialSetAsync();
				}
				else
				{
					//The data is ready
					foreach (Building b in buildings)
					{
						CurrentBuilding = b;
                        //TODO: Currently, LoadEdges just loops through the edges and does nothing
						LoadEdges(CurrentBuilding);
						break;
					}
				}
			}
			else
			{
				CurrentBuilding = null;
			}

			//Now notify the observers
			//we just let the observers know that something has happened. 
			//They can then check if CurrentBuilding != null
            //TODO: MAYBE just replace this with WifiStatusChanged, where the Status is RADIOMAP_DOWNLOADED
			
            if (OnBuildingDownload != null) //any observers?        
				OnBuildingDownload(null, null);     
		}
 void blogs_LoadCompleted(object sender, LoadCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         if (blogs.Count > 0)
         {
             cboBlogs.SelectedIndex = 0;
         }
     }
 }
Example #5
0
        private void BuildButtonList(object target, LoadCompletedEventArgs eventArgs)
        {
            ButtonList.Children.Clear();

            if (eventArgs.Error != null)
            {
                MessageBox.Show(AppResources.ErrorProcessingRequest);
            }
            else
            {
                var calcs = _calculations;

                foreach (var calc in calcs)
                {
                    var grid = new Grid();
                    grid.RowDefinitions.Add(new RowDefinition());
                    grid.RowDefinitions.Add(new RowDefinition());

                    var nameBlock = new TextBlock {Text = calc.Name, HorizontalAlignment = HorizontalAlignment.Center};
                    Grid.SetRow(nameBlock, 0);
                    grid.Children.Add(nameBlock);

                    if (calc.LastActivityTime != DateTime.MinValue)
                    {
                        var dateBlock = new TextBlock
                            {
                                Text =
                                    (calc.LastActivityTime).ToShortDateString() + " " +
                                    (calc.LastActivityTime).ToShortTimeString(),
                                FontSize = 15,
                                HorizontalAlignment = HorizontalAlignment.Center
                            };

                        Grid.SetRow(dateBlock, 1);
                        grid.Children.Add(dateBlock);
                    }

                    var button = new Button
                        {
                            Content = grid,
                            DataContext = new {DebtCalculationId = calc.Id},
                            Foreground = (SolidColorBrush) Application.Current.Resources["BlackAccentBrush"],
                            BorderBrush = (SolidColorBrush) Application.Current.Resources["BlackAccentBrush"]
                        };

                    button.Click += Button_Click;

                    ButtonList.Children.Add(button);
                }
            }
        }
        private void ItemsLoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (e.Cancelled)
            {

            }
            else if (e.Error != null)
            {

            }
            else
            {
                AllProjects = new BindableCollection<Project>(_collection);
                this.NotifyOfPropertyChange(()=> this.AllProjects);
            }
        }
        private void dataCollection_LoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                List<GetSynonymsEntitySet> list = dataCollection.ToList();

                SynonymsList.Clear();
                foreach (var entity in list)
                {
                    SynonymsList.Add(entity.Synonym);
                }
            }
            else
            {
                Console.WriteLine(e.Error.ToString());
            }
        }
 void products_LoadCompleted(object sender, LoadCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         // Handling for a paged data feed.
         if (products.Continuation != null)
         {
             // Automatically load the next page.
             products.LoadNextPartialSetAsync();
         }
         else
         {
             // Set the data context of the list box control to the sample data.
             //this.MainLongListSelector.DataContext = products;
             this.MainLongListSelector.ItemsSource = products;
         }
     }
     else
     {
         MessageBox.Show(string.Format("An error has occurred: {0}", e.Error.Message));
     }
 }
        private void OnrItemsLoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                this.rDispatchResult("The operation has been cancelled.");
            }
            else if (e.Error != null)
            {
                this.hasError = true;
                var errorMessage = StorageClientExceptionParser.ParseDataServiceException(e.Error).Message;
                this.rDispatchResult(string.Format(CultureInfo.InvariantCulture, "Error: {0}", errorMessage));
            }
            else
            {
                this.hasError = false;
                this.rcurrentPage++;
                if (this.rPageNumber < this.rcurrentPage)
                {
                    this.rPageNumber = this.rcurrentPage;
                }

                if (this.rHasContinuation && this.rPageNumber > this.rcurrentPage)
                {
                    try
                    {
                        this.rItems.LoadNextPartialSetAsync();
                    }
                    catch (Exception exception)
                    {
                        var errorMessage = StorageClientExceptionParser.ParseDataServiceException(exception).Message;
                        this.rDispatchResult(string.Format(CultureInfo.InvariantCulture, "Error: {0}", errorMessage));
                    }
                }
                else
                {
                    this.rDispatchResult();
                }
            }
        }
 private void OnItemsLoadCompleted(object sender, LoadCompletedEventArgs e)
 {
     if (e.Cancelled)
     {
         //this.DispatchResult("The operation has been cancelled.");
     }
     else if (e.Error != null)
     {
         //this.hasError = true;
         //var errorMessage = StorageClientExceptionParser.ParseDataServiceException(e.Error).Message;
         //this.DispatchResult(string.Format(CultureInfo.InvariantCulture, "Error: {0}", errorMessage));
     }
     else
     {
         //erased quite a bit here
         //this.DispatchResult();
         if (this.Items.Count == 1)
         {
             //we have an account, use this one to modify
             textBlock1.Text += "\nProfile found, going to edit page";
             PhoneHelpers.SetApplicationState("CurrentProfile", this.Items[0]);
             this.NavigationService.Navigate(new Uri("/Pages/ProfileDetailsPage.xaml?editProfile=true", UriKind.Relative));
         }
         else if (this.Items.Count == 0)
         {
             //we need to account to db
             textBlock1.Text += "\nNo profile found, creating new one";
             PhoneHelpers.RemoveApplicationState("CurrentProfile");
             this.NavigationService.Navigate(new Uri("/Pages/ProfileDetailsPage.xaml?editProfile=false", UriKind.Relative));
             
         }
         else
         {
             //more than one account something was wrong with query or something else went wrong
             textBlock1.Text += "More than one profile that matches your credentials exists in the database\nWTF did you do?!?!?!?!??";
             throw new NotImplementedException("more than one account with this info found");
         }
     }
 }
Example #11
0
 void sprints_LoadCompleted(object sender, LoadCompletedEventArgs e)
 {
 }
        protected virtual void OnLoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                this.DispatchResult("The operation has been cancelled.");
            }
            else if (e.Error != null)
            {
                var errorMessage = StorageClientExceptionParser.ParseDataServiceException(e.Error).Message;
                this.DispatchResult(string.Format(CultureInfo.InvariantCulture, "Error: {0}", errorMessage));
            }
            else if (this.Items.Continuation != null)
            {
                try
                {
                    this.Items.LoadNextPartialSetAsync();
                }
                catch (Exception exception)
                {
                    var errorMessage = StorageClientExceptionParser.ParseDataServiceException(exception).Message;

                    this.IsListing = false;
                    this.Message = string.Format(CultureInfo.InvariantCulture, "Error: {0}", errorMessage);
                }
            }
            else
            {
                this.DispatchResult();
            }
        }
        private void ShowCalculation(object target, LoadCompletedEventArgs eventArgs)
        {
            var progBar = ContentPanel.Children.First(c => c is ProgressBar);
            ContentPanel.Children.Remove(progBar);

            var calc = _calculations.SingleOrDefault();

            if (calc == null)
            {
                return;
            }

            var currentUserId = ApiHelper.CurrentUserId();

            PageHeader.Text = calc.Name;
            Phase.Text = calc.Phase;
            Description.Text = calc.Description;

            ShowParticipants(calc);

            //if (calc.Phase == DebtCalculationPhase.GatheringParticipants)
            //{
            //    var editButton = new ApplicationBarIconButton
            //        {
            //            Text = AppResources.Edit,
            //            IconUri = new Uri("/Assets/Icons/edit.png", UriKind.Relative)
            //        };

            //    editButton.Click += Some_Click;
            //    ApplicationBar.Buttons.Add(editButton);
            //}

            if (calc.Phase == DebtCalculationPhase.CollectingExpenses.ToString())
            {
                var addExpenseButton = new ApplicationBarIconButton
                    {
                        Text = AppResources.AddExpense,
                        IconUri = new Uri("/Assets/Icons/add.png", UriKind.Relative)
                    };

                addExpenseButton.Click += AddExpense_Click;
                ApplicationBar.Buttons.Add(addExpenseButton);

                MainPivot.Items.Add(ExpensesItem);

                ShowExpenses(calc);

                if (!calc.Participants.Single(p => p.User.Id == currentUserId).DoneAddingExpenses)
                {
                    var doneExpensesButton = new ApplicationBarIconButton
                        {
                            Text = AppResources.AddedExpenses,
                            IconUri = new Uri("/Assets/Icons/check.png", UriKind.Relative)
                        };

                    doneExpensesButton.Click += AddedExpenses_Click;
                    ApplicationBar.Buttons.Add(doneExpensesButton);
                }
            }

            if (calc.Phase == DebtCalculationPhase.CollectingPayments.ToString() ||
                calc.Phase == DebtCalculationPhase.Finished.ToString())
            {
                MainPivot.Items.Add(DebtsItem);
                MainPivot.Items.Add(ExpensesItem);

                ShowExpenses(calc);
                ShowDebts(calc);

                if (!calc.Participants.Single(p => p.User.Id == currentUserId).HasPaid)
                {
                    var donePaymentsButton = new ApplicationBarIconButton
                        {
                            Text = AppResources.HasPaid,
                            IconUri = new Uri("/Assets/Icons/check.png", UriKind.Relative)
                        };

                    donePaymentsButton.Click += HasPaid_Click;
                    ApplicationBar.Buttons.Add(donePaymentsButton);
                }
            }

            MainPivot.Items.Add(ParticipantsItem);
        }
        private void OnItemsLoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                //this.DispatchResult("The operation has been cancelled.");
            }
            else if (e.Error != null)
            {
                //this.hasError = true;
                //var errorMessage = StorageClientExceptionParser.ParseDataServiceException(e.Error).Message;
                //this.DispatchResult(string.Format(CultureInfo.InvariantCulture, "Error: {0}", errorMessage));
            }
            else
            {
                //erased quite a bit here
                //this.DispatchResult();
                if (this.Items.Count == 1)
                {
                    //extract info
                    isListing = false;
                    mvProgressBar.Opacity = 0;
                    AddressBox.Text += Items[0].Address;
                    CityBox.Text += Items[0].City;
                    PhoneBox.Text += Items[0].Phone;
                    if (Items[0].Image == null)
                    {
                        BitmapImage defaultImage = new BitmapImage(new System.Uri("..\\Images\\gour_noimage.png", UriKind.RelativeOrAbsolute));
                        restaurantImage.Source = defaultImage;
                        return;
                    }

                    Stream memStream = new MemoryStream(Items[0].Image);
                    memStream.Seek(0, SeekOrigin.Begin);
                    BitmapImage empImage = new BitmapImage();
                    empImage.SetSource(memStream);
                    restaurantImage.Source = empImage;
                    button1.IsEnabled = true;
                    return;
                }
                else
                {
                    //something else went wrong
                    throw new NotImplementedException("restaurant query didn't work apparently");
                }
            }
        }
 private void Events_LoadCompleted(object sender, LoadCompletedEventArgs e)
 {
     Events.LoadCompleted -= Events_LoadCompleted;
     DispatcherHelper.CheckBeginInvokeOnUI(() => IsBusy = false);
 }
 private void ent_LoadCompleted(object sender, LoadCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         MessageBox.Show(e.Error.Message, "Error", MessageBoxButton.OK);
     }
     else
     {
         var pcv = new System.Windows.Data.PagedCollectionView(((IQueryableEntity) sender).Collection);
         dataGrid1.ItemsSource = pcv;
         dataGrid1.UpdateLayout();
     }
     waitCursor.IsWaitEnable = false;
 }
Example #17
0
        private void ShowExpenseParticipants(object target, LoadCompletedEventArgs eventArgs)
        {
            var progBar = ContentPanel.Children.First(c => c is ProgressBar);
            ContentPanel.Children.Remove(progBar);

            var participantsFromServer = _participants.Select(p => p.User).ToList();

            totalParticipants = participantsFromServer.Count;

            // Doing this because of the worthless WP8 binding of list texts
            // http://stackoverflow.com/questions/16642830/windows-phone-8-bind-to-string-resource-with-format
            foreach (var user in participantsFromServer)
            {
                user.Firstname = user.FullName();
            }

            var currentUser = participantsFromServer.Single(p => p.Id == ApiHelper.CurrentUserId());

            Payer.ItemsSource = participantsFromServer;
            Payer.SelectedItem = currentUser;

            Participants.SummaryForSelectedItemsDelegate = SummarizeItems;
            Participants.ItemsSource = participantsFromServer;
            Participants.SelectedItems = participantsFromServer;
        }
        static void data_LoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            var result = sender as DataServiceCollection<JayStorm.Repository.Category>;
            foreach (var cat in result)
            {
                var group = new SampleDataGroup(cat.id,
                   cat.CategoryName,
                   cat.Name,
                   cat.ImageUrl,
                   cat.Description);

                var flowers = new DataServiceCollection<JayStorm.Repository.Flower>(SampleDataSource._context);
                flowers.LoadCompleted += flowers_LoadCompleted;
                flowers.LoadAsync(SampleDataSource._context.Flowers.Where(f => f.Category_ID == cat.id));

                _sampleDataSource.AllGroups.Add(group);
            }
        }
        void Posts_LoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                Blogs curBlog = cboBlogs.SelectedItem as Blogs;
                totalPostCount = e.QueryOperationResponse.TotalCount;
                string postsCount = string.Format("Displaying {0} of {1} posts",
                    curBlog.Posts.Count, totalPostCount);
                this.lblCount.Text = postsCount;

                curBlog.Posts.LoadCompleted -= Posts_LoadCompleted;
            }
        }
 static void flowers_LoadCompleted(object sender, LoadCompletedEventArgs e)
 {
     var flowers = (DataServiceCollection<JayStorm.Repository.Flower>)sender;
     if (flowers.Count() == 0) { return; }
     var grp = _sampleDataSource.AllGroups.FirstOrDefault(g => g.UniqueId == flowers[0].Category_ID);
     foreach (var flower in flowers)
     {
         grp.Items.Add(new SampleDataItem(flower.id,
                            flower.Name,
                            flower.Price.HasValue?flower.Price.Value:0,
                            flower.ImageUrl,
                            flower.Description,
                            "Item Description: Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat.\nItem Description: Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat.",
                            grp));
     }
 }
 private void T_Photo1_LoadCompleted(object sender, LoadCompletedEventArgs e)
 {
     LoadPhoto250Uri();
 }