protected override void OnNavigatedTo(NavigationEventArgs args)
        {
            IDictionary<string, string> parameters = this.NavigationContext.QueryString;

            if (parameters.ContainsKey("applicationId"))
            {
                string appId = parameters["applicationId"];
                MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
                client.getApplicationByIdAsync(Int32.Parse(appId));
                client.getApplicationByIdCompleted += new EventHandler<MyService.getApplicationByIdCompletedEventArgs>(client_getApplicationByIdCompleted);
                App.AppDetailViewModel.LoadData(appId);

            }
        }
 /// <summary>
 /// Creates and adds a few ItemViewModel objects into the Items collection.
 /// </summary>
 public void LoadData(string appId)
 {
     this.Comments.Clear();
     MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
     client.getCommentsAsync(appId);
     client.getCommentsCompleted += new EventHandler<MyService.getCommentsCompletedEventArgs>(client_getCommentsCompleted);
     this.IsDataLoaded = true;
 }
Exemplo n.º 3
0
        private void imgLike_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            Image img = sender as Image;
            string appId = img.Tag.ToString();

            string userId = (Application.Current as App).UserId;

            MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
            client.setLikeAsync(userId, appId);
            client.setLikeCompleted += new EventHandler<MyService.setLikeCompletedEventArgs>(client_setLikeCompleted);
        }
Exemplo n.º 4
0
        private void client_getMainCategoriesCompleted(object sender, MyService.getMainCategoriesCompletedEventArgs e)
        {
            string jsonString = e.Result.ToString();
            JObject json = JObject.Parse(jsonString);
            JArray array = (JArray) json["MainCategories"];

            foreach(JObject jobj in array){
                string Id = jobj["Id"].ToString();
                string Name = jobj["Name"].ToString();
                this.Items.Add(new CategoryViewModel() { Id = Id, CategoryName = Name });
            }

            for (int i = 0; i < this.Items.Count; i++)
            {
                MyService.WPServiceSoapClient client1 = new MyService.WPServiceSoapClient();
                client1.getCategoriesAsync(Int32.Parse(this.Items[i].Id));
                client1.getCategoriesCompleted += new EventHandler<MyService.getCategoriesCompletedEventArgs>(client_getCategoriesCompleted);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData()
        {
            // Sample data; replace with real data

            categories = new List<CategoryViewModel>();
            MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
            client.getMainCategoriesAsync();
            client.getMainCategoriesCompleted += new EventHandler<MyService.getMainCategoriesCompletedEventArgs>(client_getMainCategoriesCompleted);

            MyService.WPServiceSoapClient client1 = new MyService.WPServiceSoapClient();
            client1.getPublishersAsync();
            client1.getPublishersCompleted += new EventHandler<MyService.getPublishersCompletedEventArgs>(client_getPublishersCompleted);

            this.Reviews.Add(new NumberOfReviewsViewModel() {Text="less than 100 reviews", FromReviews=0, ToReviews=100 });
            this.Reviews.Add(new NumberOfReviewsViewModel() { Text = "from 101 to 1000", FromReviews = 101, ToReviews = 1000 });
            this.Reviews.Add(new NumberOfReviewsViewModel() { Text = "from 1001 to 5000", FromReviews = 1001, ToReviews = 5000 });
            this.Reviews.Add(new NumberOfReviewsViewModel() { Text = "from 5001 to 10000", FromReviews = 5001, ToReviews = 10000 });
            this.Reviews.Add(new NumberOfReviewsViewModel() { Text = "more than 10001", FromReviews = 10001, ToReviews = 1000000 });

            //foreach (CategoryViewModel c in categories) {
            //    subcategories = new List<SubcategoryViewModel>();
            //    //MyService.WPServiceSoapClient client1 = new MyService.WPServiceSoapClient();
            //    //client1.getCategoriesAsync(Int32.Parse(c.Id));
            //    //client1.getCategoriesCompleted += new EventHandler<MyService.getCategoriesCompletedEventArgs>(client_getCategoriesCompleted);
            //    //c.Subcategories = subcategories;
            //    this.Items.Add(c);

            //}

            //this.Items.Add(new CategoryViewModel() { Id = "3", CategoryName = "Themes" });
            this.IsDataLoaded = true;
        }
Exemplo n.º 6
0
 private void btnReg_Click(object sender, RoutedEventArgs e)
 {
     MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
     client.registerUserAsync(txtFirstName.Text, txtSecondName.Text, txtUsername1.Text, txtPassword1.Password);
     client.registerUserCompleted += new EventHandler<MyService.registerUserCompletedEventArgs>(client_registerUserCompleted);
 }
Exemplo n.º 7
0
 private void btnLogIn_Click(object sender, RoutedEventArgs e)
 {
     MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
     client.getUserAsync(txtUsername.Text, txtPassword.Password);
     client.getUserCompleted += new EventHandler<MyService.getUserCompletedEventArgs>(client_getUserCompleted);
 }
        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData(string fromPage, string cpId, string toR="")
        {
            this.Items.Clear();
            this.Sorry.Clear();
            string userId = (Application.Current as App).UserId;
            // Sample data; replace with real data
            if (fromPage.Equals("categories"))
            {
                int cId = Int32.Parse(cpId);
                MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();

                client.getApplicationsByCategoryAsync(cId, userId);
                client.getApplicationsByCategoryCompleted += new EventHandler<MyService.getApplicationsByCategoryCompletedEventArgs>(client_getApplicationsByCategoryCompleted);
            }
            else if (fromPage.Equals("publishers")) {
                int pId = Int32.Parse(cpId);
                MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
                client.getApplicationsByPublisherAsync(pId, userId);
                client.getApplicationsByPublisherCompleted += new EventHandler<MyService.getApplicationsByPublisherCompletedEventArgs>(client_getApplicationsByPublisherCompleted);
            }
            else if (fromPage.Equals("reviews"))
            {
                int from = Int32.Parse(cpId);
                int to = Int32.Parse(toR);
                MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
                client.getApplicationsByReviewsAsync(from, to, userId);
                client.getApplicationsByReviewsCompleted += new EventHandler<MyService.getApplicationsByReviewsCompletedEventArgs>(client_getApplicationsByReviewCompleted);
            }
            else if (fromPage.Equals("search")) {
                searchText = cpId;
                MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
                client.getApplicationsByNameAsync(searchText, userId);
                client.getApplicationsByNameCompleted += new EventHandler<MyService.getApplicationsByNameCompletedEventArgs>(getApplicationsByNameCompleted);
            }
            else if (fromPage.Equals("recommendation"))
            {
                MyService.WPServiceSoapClient client = new MyService.WPServiceSoapClient();
                client.getApplicationsByRecommendationAsync((Application.Current as App).UserId);
                client.getApplicationsByRecommendationCompleted += new EventHandler<MyService.getApplicationsByRecommendationCompletedEventArgs>(client_getApplicationsByReccomendationCompleted);
            }

            //this.Items.Add(new AppViewModel() { Id = "3", CategoryName = "Themes" });
            this.IsDataLoaded = true;
        }