Пример #1
0
        // When page is navigated to set data context to selected item in list
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string selectedIndex = "";
            if (NavigationContext.QueryString.TryGetValue("selectedItem", out selectedIndex))
            {
                int index = int.Parse(selectedIndex);
                if (App.ViewModel.Items.Count > 0)
                {
                    var worker = App.ViewModel.Items[index];

                    ServiceReferenceWorkerz.WebServiceWorkerzSoapClient client = new ServiceReferenceWorkerz.WebServiceWorkerzSoapClient();
                    client.GetWorkerDetailsCompleted += new EventHandler<ServiceReferenceWorkerz.GetWorkerDetailsCompletedEventArgs>(client_GetWorkerDetailsCompleted);
                    peopleID = int.Parse(worker.PeopleID);
                    UserName = worker.UserName;
                    ImageOne = worker.ImageOne;
                    client.GetWorkerDetailsAsync(peopleID);
                    //DataContext = App.ViewModel.Items[index];
                }
                else
                {
                    //go back
                }

            }
        }
Пример #2
0
        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData()
        {
            //User Service
            if (!this.IsDataLoaded)
            {
                ServiceReferenceWorkerz.WebServiceWorkerzSoapClient client = new ServiceReferenceWorkerz.WebServiceWorkerzSoapClient();
                if (_selection == currentSelection.In || _selection == currentSelection.Out)
                {

                    client.GetWorkerzInAndOutCompleted += new EventHandler<ServiceReferenceWorkerz.GetWorkerzInAndOutCompletedEventArgs>(client_GetWorkerzInAndOutCompleted);

                    client.GetWorkerzInAndOutAsync();

                    // Sample data; replace with real data
                    //this.Items.Add(new ItemViewModel() { ImageOne="jeff.jpg", LineOne = "Jeff Meyers", LineTwo = "Maecenas praesent accumsan bibendum", LineThree = "Facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu" });
                    //this.Items.Add(new ItemViewModel() { ImageOne = "jeff.jpg", LineOne = "Huey Lewis", LineTwo = "Dictumst eleifend facilisi faucibus", LineThree = "Suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus" });
                }
                else
                {
                    client.GetWorkerzAllCompleted += new EventHandler<ServiceReferenceWorkerz.GetWorkerzAllCompletedEventArgs>(client_GetWorkerzAllCompleted);

                    client.GetWorkerzAllAsync();

                }

            }
        }