Inheritance: System.ComponentModel.AsyncCompletedEventArgs
Esempio n. 1
0
 static void client_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         log.Debug("保存数据失败!" + e.Error.ToString());
     }
 }
        private void uploadResetComplete(object sender, UploadStringCompletedEventArgs e)
        {
            try
            {
                JObject jresult = JObject.Parse(e.Result);
                string Result = jresult["result"].ToString();

                if (Result.Equals("sukses"))
                {
                    MessageBox.Show("Please check your email!");
                    NavigationService.Navigate(new Uri("/Views/PageStart4.xaml", UriKind.Relative));
                }
                else
                {
                    MessageBox.Show("Your email is not registered");
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("Login failed. Please check your internet connection");
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Login failed. Please check your username or password");
            }
            catch (WebException)
            {
                MessageBox.Show("Login failed. Please check your internet connection");
            }

        }
Esempio n. 3
0
 void webclient_FileUploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     WebClient webclient = (WebClient)sender;
     webclient.UploadStringCompleted -= new UploadStringCompletedEventHandler(webclient_FileUploadStringCompleted);
     webclient.UploadProgressChanged -= new UploadProgressChangedEventHandler(webclient_UploadProgressChanged);
     result2.Text = e.Result;
 }
Esempio n. 4
0
        private void signinComplete(object sender, UploadStringCompletedEventArgs e)
        {
            progressBarLogin.Visibility = Visibility.Collapsed;
            try
            {
                if ((e.Result != null) && (e.Error == null))
                {

                    string jsonString = e.Result.ToString();

                    using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(jsonString)))
                    {
                        var response = new DataContractJsonSerializer(typeof(User));
                        User user = (User)response.ReadObject(ms);

                        if (user.LoginState == "ok")
                        {
                            // saving state and moving to the next page
                            ApplicationStateHelper.SaveUserToIsolatedStorage(user);
                            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                        }
                        else
                        {
                            MessageBox.Show("Unable to Sign In. Try again...");
                        }

                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to Sign In.");
            }
        }
        private void DeleteCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            try
            {
                CheckForErrors(e);

                string returnTypeName = app.GetBusinessObjectType(e.Result);

                switch (returnTypeName)
                {
                    case "Acknowledgement":
                        PartyService.Acknowledgement ack = app.LoadBusinessObject<PartyService.Acknowledgement>(e.Result);
                        MessagePopUp ackPopUp = new MessagePopUp(ack.Message, MessagePopUp.MessagePopUpType.OK);
                        ackPopUp.Show();
                        break;
                    case "Error":
                        PartyService.Error err = app.LoadBusinessObject<PartyService.Error>(e.Result);
                        throw (new Exception(err.Message));
                    default:
                        throw (new Exception("Unrecognised object type in server response"));
                }

            }
            catch (Exception ex)
            {
                app.ShowError(ex.Message);
            }
            finally
            {
                formBusyIndicator.IsBusy = false;
            }
        }
Esempio n. 6
0
        private void LoginValidated(object target, UploadStringCompletedEventArgs eventArgs)
        {
            var progBar = ContentPanel.Children.First(c => c is ProgressBar);
            ContentPanel.Children.Remove(progBar);

            if (eventArgs.Error != null)
            {
                MessageBox.Show(AppResources.ErrorProcessingRequest);
            }
            else
            {
                dynamic result = JsonConvert.DeserializeObject(eventArgs.Result);
                var userId = long.Parse(result.value.Value);

                if (userId > 0)
                {
                    ApiHelper.SaveCredentials(email, password);
                    ApiHelper.SaveCurrentUserId(userId);

                    NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                }
                else
                {
                    MessageBox.Show(AppResources.LoginFailed);
                }
            }
        }
 void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         JsonArray items = JsonValue.Parse(e.Result) as JsonArray;
         ObjectList list = new ObjectList();
         list.EntityType = "T_INSPECTION_LINE";
         foreach(JsonObject row in items)
         {
             GeneralObject go = new GeneralObject();
             go.EntityType = "T_INSPECTION_LINE";
             go.SetPropertyValue("precaution", row["precaution"], true);
             go.SetPropertyValue("road", row["road"], true);
             go.SetPropertyValue("unit_name", row["unit_name"], true);
             go.SetPropertyValue("cus_dom", row["cus_dom"], true);
             go.SetPropertyValue("cus_dy", row["cus_dy"], true);
             go.SetPropertyValue("cus_floor", row["cus_floor"], true);
             go.SetPropertyValue("cus_room", row["cus_room"], true);
             go.SetPropertyValue("user_name", row["user_name"], true);
             go.SetPropertyValue("telphone", row["telphone"], true);
             go.SetPropertyValue("departure_time", row["departure_time"], true);
             go.SetPropertyValue("precaution_notified", row["precaution_notified"], true);
             go.SetPropertyValue("sn", row["sn"], true);
             list.Add(go);
         }
         paperGrid.ItemsSource = list;
     }
 }
 void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     (sender as WebClient).UploadStringCompleted -= wc_UploadStringCompleted;
     print.State = State.Start;
     print.TipPrint();
     VerificationPopUp.Visibility = Visibility.Collapsed;
 }
        /// <summary>
        /// Response of webservice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SendOrderwebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            SendOrderResponse objSendOrderResponse = new SendOrderResponse();
            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objSendOrderResponse = Utils.JsonHelper.Deserialize<SendOrderResponse>(response);

                    if (objSendOrderResponse.status == 0)
                    {
                        App.TombStonedPageURL ="RequestSent";
                        confirmRepeatViewModel.IsPopupSentOpen = true;
                        confirmRepeatViewModel.HitVisibility = false;
                        App.prescriptionCollection.Clear();
                    }

                }
            }
            catch (Exception)
            {
                confirmRepeatViewModel.HitVisibility = true;
                MessageBox.Show("Sorry, Unable to process your request.");
            }
           
        }
Esempio n. 10
0
 private void registrationComplete(object sender, UploadStringCompletedEventArgs e)
 {
     LoadingProgressIndicator.Show(false);
     var registerSuccess = (e.Error == null);
     MessageBox.Show(registerSuccess ? AppResources.RegisterSuccess : AppResources.RegisterFailure, "",
         MessageBoxButton.OK);
 }
Esempio n. 11
0
 private void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     if (!CheckFault(e))
     {
         this.ParseResult(e.Result, e.UserState);
     }
 }
Esempio n. 12
0
        private void dataCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                try
                {
                    XDocument doc = XDocument.Parse(e.Result);
                    if (doc.Element("validity") == null && doc.Element("validity") == null)
                    {
                        this.DialogResult = true;
                    }
                    else if (doc.Element("validity") != null)
                    {
                        lbl_confirm_fail.Content = (string)doc.Element("validity");
                        lbl_confirm_fail.Visibility = Visibility.Visible;
                        txt_username.Focus();
                    }
                    else
                    {
                        MessageBox.Show("Error: " + (string)doc.Element("error"));
                        txt_username.Focus();
                    }
                }
                catch (Exception e1)
                {
                    MessageBox.Show("Error: " + e1.ToString());
                }
            }

            else
            {
                MessageBox.Show("ERROR " + e.Error.ToString());
            }
        }
        /// <summary>
        /// Response of web service
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChangePinWebServiceCall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            ChangePinResponse objChangePinResponse = new ChangePinResponse();
            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objChangePinResponse = Utils.JsonHelper.Deserialize<ChangePinResponse>(response);
                    if (objChangePinResponse.status == 0)
                    {
                        App.PIN = objSettingsConfirmChangePinVM.Pin;
                        App.HashPIN = newPinHashed;
                        objSettingsConfirmChangePinVM.IsSuccessPopupOpen = true;
                        objSettingsConfirmChangePinVM.HitVisibility = false;
                        objSettingsConfirmChangePinVM.SuccessPopupText = objChangePinResponse.message;
                    }
                    else
                    {
                        objSettingsConfirmChangePinVM.IsSuccessPopupOpen = true;
                        objSettingsConfirmChangePinVM.HitVisibility = false;
                        objSettingsConfirmChangePinVM.SuccessPopupText = objChangePinResponse.message;
                    }
                }
            }
            catch (Exception)
            {
                objSettingsConfirmChangePinVM.HitVisibility = true;
            
                MessageBox.Show("Sorry, Unable to process your request.");
            } 

        } 
Esempio n. 14
0
        private void UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {

                JObject jRoot = JObject.Parse(e.Result);
                if (JsonHelpers.GetStatusCode(jRoot) == 200)
                {
                    var skippedTags = new List<KeyValuePair<string, string>>();

                    if (jRoot["response"].HasValues)
                    { 
                        JArray jItems = jRoot["response"]["skipped"] as JArray;

                        skippedTags = jItems.Select(jItem => new KeyValuePair<string, string>(jItem.Value<string>("tag"), jItem.Value<string>("reason"))).ToList();
                    }

                    OnSendingComplete(this, new CustomEventArgs<List<KeyValuePair<string, string>>>{Result = skippedTags});
                }
                else
                    OnError(this, new CustomEventArgs<string> { Result = JsonHelpers.GetStatusMessage(jRoot) });
            }
            else
                OnError(this, new CustomEventArgs<string> { Result = e.Error.Message });
        }
Esempio n. 15
0
        void wbClient_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            try
            {
                Stream stream = new MemoryStream(Encoding.Unicode.GetBytes(e.Result));
                DataContractJsonSerializer obj = new DataContractJsonSerializer(typeof(SFLoginResponse));
                slResponse = (SFLoginResponse)obj.ReadObject(stream);
                //txtUserName.Text = slResponse.id;
                BoothLeadGlobalAccess.Access_Token = "Bearer " + slResponse.access_token;
                //BoothLeadGlobalAccess.SfUserId = slResponse.id;

                WebClient wbClient = new WebClient();
                string loginURL = string.Format(SalesForceServiceURL.SVC_LOGIN_URL,txtUserName.Text,txtPassword.Password);
                //string loginURL = string.Format(SalesForceServiceURL.SVC_LOGIN_URL, "*****@*****.**", "global281");
                //string loginURL = string.Format(SalesForceServiceURL.SVC_LOGIN_URL, "*****@*****.**", "booth281");
                //string loginURL = string.Format(SalesForceServiceURL.SVC_LOGIN_URL, "*****@*****.**", "global281");
                //string loginURL = string.Format(SalesForceServiceURL.SVC_LOGIN_URL, "*****@*****.**", "windows123");
                //string loginURL = string.Format(SalesForceServiceURL.SVC_LOGIN_URL, "*****@*****.**", "booth281");
                //string loginURL = string.Format(SalesForceServiceURL.SVC_LOGIN_URL, "*****@*****.**", "global281");
                wbClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wbClient_DownloadStringCompleted);
                wbClient.Headers["Authorization"] = BoothLeadGlobalAccess.Access_Token;
                wbClient.DownloadStringAsync(new Uri(loginURL));
                ////wbClient.UploadStringAsync(new Uri(loginURL), "POST", string.Empty);
                //bool bresult = wbClient.IsBusy;
                //SFLoginResponse response = slResponse;
            }
            catch(Exception excp)
            {
                MessageBox.Show(excp.Message);
            }

        }
Esempio n. 16
0
        void web_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            Progress.IsIndeterminate = false;

            ((ApplicationBarIconButton)e.UserState).IsEnabled = true;

            try
            {
                LoginResponse deserializedResponse = JsonConvert.DeserializeObject<LoginResponse>(e.Result);
                if (deserializedResponse.error == null)
                {
                    IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
                    if (settings.Contains("ID"))
                    {
                        settings.Remove("ID");
                    }
                    settings.Add("ID", deserializedResponse.data.Id);
                    NavigationService.Navigate(new Uri("/Landing.xaml", UriKind.Relative));
                }
                else
                {
                    MessageBox.Show(deserializedResponse.error.Message);
                    txtUserName.IsEnabled = true;
                    txtPassword.IsEnabled = true;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("İnternet bağlantınızla ilgili bir sorun var");
                txtUserName.IsEnabled = true;
                txtPassword.IsEnabled = true;
            }
        }
        private void uploadRegisterComplete(object sender, UploadStringCompletedEventArgs e)
        {
            try
            {
                string Result;
                JObject jresult = JObject.Parse(e.Result);
                Result = jresult["result"].ToString();

                if (Result.Equals("sukses"))
                {
                    MessageBox.Show("Your account password has been updated!");
                    
                    NavigationService.Navigate(new Uri("/Views/PageMenu.xaml", UriKind.Relative));
                }
                else
                {
                    MessageBox.Show("An error occurred when update. Please Repeat!");
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("Update failed. Please check your connection!");
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Update failed. Please check your connection!");
            }
            catch (WebException)
            {
                MessageBox.Show("Update failed. Please check your connection!");
            }
        }
Esempio n. 18
0
 public void OnLoggedIn(object sender, UploadStringCompletedEventArgs e)
 {
     lock (this)
     {
         CheckLoggedIn();
     }
 }
Esempio n. 19
0
 private void download_allToSearch(object sender, UploadStringCompletedEventArgs e)
 {
     try
     {
         JObject obj = JObject.Parse(e.Result);
         //System.Diagnostics.Debug.WriteLine(obj);
         JArray jarr = (JArray)obj["discipline"];
         foreach (var item in jarr)
         {
             _list_Res.Add(new Resultat(int.Parse(item["id"].ToString()), item["libelle"].ToString(), "Discipline"));
         }
         JArray jarr2 = (JArray)obj["thematique"];
         foreach (var item2 in jarr2)
         {
             _list_Res.Add(new Resultat(int.Parse(item2["id"].ToString()), item2["libelle"].ToString(), "Thématique"));
         }
         JArray jarr3 = (JArray)obj["sousthematique"];
         foreach (var item3 in jarr3)
         {
             _list_Res.Add(new Resultat(int.Parse(item3["id"].ToString()), item3["libelle"].ToString(), "Sous-Thématique"));
         }
         progressBar.Visibility = Visibility.Collapsed;
         fillListBox(String.Empty);
     }
     catch (Newtonsoft.Json.JsonReaderException)
     {
         asyncTask();
     }
     catch (System.Reflection.TargetInvocationException)
     {
         asyncTask();
     }
 }
Esempio n. 20
0
        public void uCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            //MessageBox.Show(e.Result); //debug mode

            //butonu aktif ediyoruz
            register.IsEnabled = true;

            try
            {
                if (classes.Oauth.ParseXML("result", e.Result) == "1")
                {
                    MessageBox.Show(classes.General.DecodeBase64(classes.Oauth.ParseXML("result_text", e.Result)));
                    //NavigationService.Navigate(new Uri("/Login.xaml", UriKind.Relative));
                    NavigationService.GoBack();
                }
                else if (classes.Oauth.ParseXML("result", e.Result) == "0" && classes.Oauth.ParseXML("result_text", e.Result) != "")
                    MessageBox.Show(classes.General.DecodeBase64(classes.Oauth.ParseXML("result_text", e.Result)));
            }
            catch (TargetInvocationException ex)
            {
                //BugSenseHandler.Instance.SendExceptionAsync(ex);

                MessageBox.Show("Lütfen yeniden deneyin.");
                //MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                //BugSenseHandler.Instance.SendExceptionAsync(ex);

                MessageBox.Show("Bir hata oluştu : r0x001");
                //General.SendBugReport(e.Result, "r0x001", ex.Message, ex.Source, ex.HelpLink);
            }
        }
Esempio n. 21
0
        void completed_register(Object sender, UploadStringCompletedEventArgs e)
        {
            string json = (string)e.Result;
            if (json.Length < 5)
            {
                MessageBox.Show("BF3Stats.com is down. Cannot download your statistics. Try back later.");
            }
            else
            {
                try
                {
                    JObject data = JObject.Parse(json);
                    if (data["status"].ToString() == "ok")
                    {
                        Configs.SetIdent(data["ident"].ToString());
                        Configs.SetAPIkey(data["key"].ToString());
                    }
                }
                catch (Exception ex)
                {

                    MessageBox.Show(ex.ToString());
                }
            }
        }
        /// <summary>
        /// Method to get response of web service
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void resetpinswebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            ResetPinResponse objResetPinResponse = new ResetPinResponse();
            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objResetPinResponse = Utils.JsonHelper.Deserialize<ResetPinResponse>(response);

                    if (objResetPinResponse.status == 0)
                    {
                        objVerifyBySmsViewModel.IsResentPopupOpen = true;
                        objVerifyBySmsViewModel.HitVisibility = false;

                    }
                    else if (objResetPinResponse.status == 324)
                    {
                        objVerifyBySmsViewModel.IsRequestPopupOpen = true;
                        objVerifyBySmsViewModel.HitVisibility = false;
                        objVerifyBySmsViewModel.PopupText = objResetPinResponse.message;
                    }
                }
            }
            catch (Exception)
            {
                objVerifyBySmsViewModel.HitVisibility = true;
                MessageBox.Show("Sorry, Unable to process your request.");
               
            }
            
        }
Esempio n. 23
0
 void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     this.Dispatcher.BeginInvoke(() =>
     {
         this.activity.IsActive = false;
         HtmlPage.Window.Alert(e.Result);
     });
 }
        private void GetReportOnUploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            if (e.Error != null) return;

            DynamicReport.UpdateModel(e.Result);
            eventAggregator.GetEvent<InitialiseDynamicColumnsEvent>().Publish(null);
            OnPropertyChanged("DynamicReport");
        }
Esempio n. 25
0
 void wbClient_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     Stream stream = new MemoryStream(Encoding.Unicode.GetBytes(e.Result));
     DataContractJsonSerializer obj = new DataContractJsonSerializer(typeof(List<LeadDetail>));
     eventLeadsGlobal = (List<LeadDetail>)obj.ReadObject(stream);
     LoadListView(eventLeadsGlobal,null);
     ProxyLeadList.Leads = eventLeadsGlobal;
 }
Esempio n. 26
0
 /// <summary>
 /// Call back from web client
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _webClient_UploadStringCompleted( object sender, UploadStringCompletedEventArgs e )
 {
     if ( e.Error == null && !e.Cancelled ) {
         NotifyCompleted( true, e.Result, string.Empty );
     }
     else {
         NotifyCompleted( false, string.Empty, e.Error.Message );
     }
 }
Esempio n. 27
0
        void client1_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            WebClient client1 = sender as  WebClient;
            client1.UploadStringCompleted -= client1_UploadStringCompleted;

            BatchExcuteAction save1 = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;
            save1.Completed += save1_Completed;
            save1.Invoke();
        }
Esempio n. 28
0
 private void UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
 {
     var argFunc = (e.Error != null || e.Cancelled)
                                                   ? (Func<PublishCompletedEventArgs>)(() =>
                                                     new PublishCompletedEventArgs(e.Error, e.Cancelled,
                                                                                   e.UserState))
                                                   : () => new PublishCompletedEventArgs(e.Result.Replace("\\", "").Replace("\"", ""));
     PublishCompleted.Raise(this, argFunc);
 }
Esempio n. 29
0
 public void eventhandler(object sender, UploadStringCompletedEventArgs e)
 {
     lock (this)
     {
         if (Networking.Results.ContainsKey("apitoken"))
         {
             NavigationService.Navigate(new Uri("/Joining Game.xaml?Code=" + Networking.Results["apitoken"], UriKind.Relative));
         }
     }
 }
Esempio n. 30
0
 public void eventhandler(object sender, UploadStringCompletedEventArgs e)
 {
     lock (this)
     {
         if (Networking.Apitoken != "")
         {
             NavigationService.Navigate(new Uri("/LobbyScreen.xaml", UriKind.Relative));
         }
     }
 }
 private void PushMsgServiceUploadStringCompleted(object sender, System.Net.UploadStringCompletedEventArgs e)
 {
     try
     {
         this.OnUploadReceived(e);
     }
     catch (WebException)
     {
         // Take appropriate action here
         return;
     }
 }
Esempio n. 32
0
            // get the asynchronous response for a specific address
            internal void INTERNAL_OnAsyncResponse(object sender, UploadStringCompletedEventArgs e)
            {
                WebClientWithCredentials wc = (WebClientWithCredentials)sender; // can't be another type

                wc.INTERNAL_AddNewCookiesInContainer_SimulatorOnly(this);
            }
Esempio n. 33
0
 protected virtual void OnUploadStringCompleted(UploadStringCompletedEventArgs e)
 {
     throw new NotImplementedException();
 }
Esempio n. 34
0
 private void Webclient_UploadStringCompleted(object sender, System.Net.UploadStringCompletedEventArgs e)
 {
     throw new NotImplementedException();
 }
 protected virtual new void OnUploadStringCompleted(UploadStringCompletedEventArgs e)
 {
 }