private void Client_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
        {
            collection            = new PagedCollectionView((System.Collections.IEnumerable)e.Result);
            dgCliente.ItemsSource = collection;

            client.CloseAsync();
        }
        private async void GarconClient_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                if (e.Error.Message.Contains("403"))
                {
                    var ipServidor = txtIP.Text;
                    await SecureStorage.SetAsync("ip_servidor", ipServidor);

                    await SecureStorage.SetAsync("numero_mesa", txtNumeroMesa.Text);

                    HideActivityIndicator();

                    PopupNavigation.Instance.PushAsync(new PasswordPopupPage());
                }
                else
                {
                    if (_attempt < 3)
                    {
                        _attempt++;
                        Thread.Sleep(TimeSpan.FromSeconds(2));

                        ServerIsAlive();
                    }
                    else
                    {
                        _attempt = 0;

                        DisplayAlertOnMainThread("NÃO FOI POSSÍVEL CONECTAR", "Servidor não está respondendo.\n\nErro: " + e.Error.Message, "FECHAR");

                        HideActivityIndicator();
                    }
                }
            }
        }
Example #3
0
 void client_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         this.textBox1.Text = e.Result;
     }
     else
     {
         this.textBox1.Text = "failed";
     }
 }
Example #4
0
 void client_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
 {
     using (XmlReader xReader = XmlReader.Create(new StringReader(e.Result)))
     {
         for (int i = 0; i < e.Result.Split(';').Length - 1; i++)
         {
             if (e.Result.Split(';')[i].Split(',')[0].IndexOf("textBox") > -1)
             {
                 TextBlock tt = ((TextBlock)this.FindName(e.Result.Split(';')[i].Split(',')[0]));
                 tt.Text = e.Result.Split(';')[i].Split(',')[1];
             }
         }
     }
 }
Example #5
0
 void client_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
 {
     using (XmlReader xReader = XmlReader.Create(new StringReader(e.Result)))
     {
         for (int i = 0; i < e.Result.Split(';').Length - 1; i++)
         {
             if (e.Result.Split(';')[i].Split(',')[0].IndexOf("textBox") > -1)
             {
                 TextBlock tt = ((TextBlock)this.FindName(e.Result.Split(';')[i].Split(',')[0]));
                 tt.Text = e.Result.Split(';')[i].Split(',')[1];
             }
         }
     }
 }
        private void client_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                this.ProcessError(this.connectingServerStep, e.Error);
            }
            else
            {
                this.connectingServerStep.Success();
                this.datatransferingStep.Start();
                if (this.SyncActionPicker.SelectedIndex == 0)
                {
                    try
                    {
                        DataSynchronizationInfo data = null;
                        BackupDataOption option = new BackupDataOption
                        {
                            TotalEffects = 0,
                            DbFileNameTobackup = DataSynchronizationHandler.DatabaseFileToBackup,
                        };

                        DataBackupedFromPhone phone = this.dataSynchronizationHandler.BackupData(option, delegate(DataSynchronizationInfo callBack)
                        {
                            data = callBack;
                        });
                        DataSynchronizationArgs arg = new DataSynchronizationArgs
                        {
                            AccountItemListXmlSource = phone.AccountItemXmlSource,
                            AppSettingsXmlSource = data.GetMessage(),
                            CategoryListXmlSource = phone.CategoryListXmlSource,
                            SdfFileContent = phone.SdfFileContent
                        };
                        this.serverProxy.BackupAsync(arg, data);
                    }
                    catch (System.Exception exception)
                    {
                        this.ProcessError(this.datatransferingStep, exception);
                    }
                }
                else
                {
                    int selectedIndex = this.CoverOrAppendPicker.SelectedIndex;
                    this.dataSynchronizationHandler.RestoreOption = (selectedIndex == 0) ? ActionOption.Cover : ActionOption.Append;
                    this.serverProxy.RestoreAsync((selectedIndex == 0) ? DataSynchronizationActionOption.Cover : DataSynchronizationActionOption.Append);
                }
            }
        }
        private async void GarconClient_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                _attempt = 0;

                App.User     = txtUser.Text;
                App.Password = txtPassword.Text;

                var jsonData = e.Result;

                if (!string.IsNullOrEmpty(jsonData))
                {
                    App.Categorias = JsonConvert.DeserializeObject <List <Categoria> >(jsonData);

                    DisplayAlertOnMainThread("ATUALIZAÇÃO CONCLUÍDA", "Informações carregadas com sucesso!", "FECHAR");

                    await PopupNavigation.Instance.PopAsync(true);

                    App.Current.MainPage = new MenuPage();
                }

                HideProgressDialogOnMainThread();
            }
            else
            {
                if (_attempt < 3)
                {
                    _attempt++;
                    Thread.Sleep(TimeSpan.FromSeconds(2));

                    GetData();
                }
                else
                {
                    _attempt = 0;

                    DisplayAlertOnMainThread("NÃO FOI POSSÍVEL OBTER AS INFORMAÇÕES", "Usuário ou senha incorretos.\n\nErro: " + e.Error.Message, "FECHAR");

                    HideProgressDialogOnMainThread();
                }
            }
        }
 private void Client_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
 {
     this.DataContext = e.Result;
 }
        // Helper Method to parse the XML response from the callback
        private void dataResponse(GetDataCompletedEventArgs Response)
        {
            List<String> metadataColListName = new List<String>();
            List<String> metadataColListId = new List<String>();
            List<String> metadataRowListName = new List<String>();
            List<String> metadataRowListValue = new List<String>();

            Console.WriteLine("Response received");
            string xmlresultObject = Response.Result.ResultObject.ToString();
            /*// Console.WriteLine("xmlresultObject = {0}", xmlresultObject);
            //xmlresultObject=
            <GetData><MetaData>
                        <Columns>
                            <col id="No" name="No" type="number" />
                            <col id="Network_id" name="Network_id" type="number" />
                            <col id="service_x0020_group" name="service group" type="string" />
                            <col id="Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_" name="Avg Data Volume per Session (MB)" type="number" />
                            <col id="ROWID" name="ROWID" type="string" />
                        </Columns>
                        <Pagination actualPage="1" totalRowCount="6" totalPages="1" pageSize="25" />
                        <AdditionalProperties><AdditionalProperty name="ROWNUM_COLID" value="No" />
                        </AdditionalProperties>
                        </MetaData>
                        <Data><row No="1" Network_id="6" service_x0020_group="Communication / Messaging" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.01" ROWID="-979132663" /><row No="2" Network_id="5" service_x0020_group="Download / Upload / Gaming" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.47" ROWID="-876054502" /><row No="3" Network_id="4" service_x0020_group="Browsing" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.13" ROWID="-788535925" /><row No="4" Network_id="3" service_x0020_group="Streaming" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="1.98" ROWID="1697245990" /><row No="5" Network_id="2" service_x0020_group="Mail" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.08" ROWID="-867832989" /><row No="6" Network_id="1" service_x0020_group="Others" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.01" ROWID="1497011326" />
                        </Data>
                      </GetData>
                            */

            /*// FirstNode is <MetaData>
            // Console.WriteLine("xmlFromMemStream.FirstNode:{0}",xElementFromStream.FirstNode);
             xElementFromStream.FirstNode =
                      <MetaData>
                          <Columns>
                            <col id="No" name="No" type="number" />
                            <col id="Network_id" name="Network_id" type="number" />
                            <col id="service_x0020_group" name="service group" type="string" />
                            <col id="Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_" name="Avg Data Volume per Session (MB)" type="number" />
                            <col id="ROWID" name="ROWID" type="string" />
                          </Columns>
                          <Pagination actualPage="1" totalRowCount="6" totalPages="1" pageSize="25" />
                          <AdditionalProperties>
                            <AdditionalProperty name="ROWNUM_COLID" value="No" />
                          </AdditionalProperties>
                     </MetaData>
                     */

            /*// LastNode is <Data>
            // Console.WriteLine("xmlFromMemStream.LastNode:{0}",xElementFromStream.LastNode);
             xml.LastNode =
                     	<Data>
                            <row No="1" Network_id="6" service_x0020_group="Communication / Messaging" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.01" ROWID="-979132663" />
                            <row No="2" Network_id="5" service_x0020_group="Download / Upload / Gaming" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.47" ROWID="-876054502" />
                            <row No="3" Network_id="4" service_x0020_group="Browsing" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.13" ROWID="-788535925" />
                            <row No="4" Network_id="3" service_x0020_group="Streaming" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="1.98" ROWID="1697245990" />
                            <row No="5" Network_id="2" service_x0020_group="Mail" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.08" ROWID="-867832989" />
                            <row No="6" Network_id="1" service_x0020_group="Others" Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_="0.01" ROWID="1497011326" />
                     	<Data>
                    */

            var memStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes (Response.Result.ResultObject.ToString()));

            // Read the XML from memstream with XElement from XLinq
            XElement xElementFromStream = XElement.Load(memStream);

            // Assign Metadata and Data children to 2 lists that will feed the Chart
            if (xElementFromStream != null)
            {
                // ********* XML MetaData ********
                System.Collections.Generic.IEnumerable<XElement> xmlMetaDataSerie =
                    xElementFromStream.Descendants("MetaData").Descendants("col");;

                // Add the name tag content to a list to pass it to the chart
                foreach(XElement col in xmlMetaDataSerie)
                {
                    metadataColListName.Add(col.Attribute("name").Value.ToString());
                    metadataColListId.Add(col.Attribute("id").Value.ToString());
                }
                Console.WriteLine("Total Metadata Columns: {0}", metadataColListName.Count);
                i=0;
                foreach (string column in metadataColListName)
                {
                    Console.WriteLine(" - metadataColList[{0}]: Name={1} | Id={2}", i,
                                      metadataColListName[i], metadataColListId[i]);
                    i++;
                }

                // ********* XML Data ********
                System.Collections.Generic.IEnumerable<XElement> xmlDataSerie =
                    xElementFromStream.Descendants("Data").Descendants("row");;

                // Add the name tag content to a list to pass it to the chart
                foreach(XElement row in xmlDataSerie)
                {
                    //Console.WriteLine("Data row :{0}", row.ToString());
                    metadataRowListName.Add(row.Attribute("service_x0020_group").Value.ToString());
                    metadataRowListValue.Add(row.Attribute("Avg_x0020_Data_x0020_Volume_x0020_per_x0020_Session_x0020__x0028_MB_x0029_").Value.ToString());
                }

                Console.WriteLine("Total Data Rows: {0}", metadataRowListName.Count);
                i=0;
                foreach (string row in metadataRowListName)
                {
                    Console.WriteLine(" - metadataRowList[{0}]: Name={1} | Value={2}", i,
                                      metadataRowListName[i], metadataRowListValue[i]);
                    i++;
                }

                // Update Pie chart from the main UI Thread. To do so, need to use  NSObject.InvokeOnMainThread
                //  as Access to UI elements should be limited to the same thread that is running the main loop
                InvokeOnMainThread (delegate {
                    loadingOverlay.Hide ();
                    View.AddSubview(chart_DSC);

                    i=0;
                    pie_DSC.Clear();
                    foreach (string row in metadataRowListName)
                    {
                        //Adding one by one series name and values - using random colors (not specified in the call)
                        pie_DSC.Add(Convert.ToDouble(metadataRowListValue[i]),metadataRowListName[i]);
                        i++;
                    }
                    // Changing Fomat of the pie to %
                    pie_DSC.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Percent;
                    //pie_DSC.Labels.TrimToSize();

                });
            }
        }
 void client_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
 {
     tbSerivceResult.Text = e.Result;
 }