Example #1
0
        private void SetLocalization()
        {
            LocalizationWebServiceClient client = new LocalizationWebServiceClient();

            Localization[] localizationDtos = client.getLocalizationListDto();

            foreach (var item in localizationDtos)
            {
                System.Console.WriteLine(item.id + " " + item.name + " " + item.photo);
                Form1ListItem listItem = new Form1ListItem();
                listItem.Title    = item.name;
                listItem.Subtitle = item.id;

                if (item.photo != null)
                {
                    System.Net.WebRequest  request        = System.Net.WebRequest.Create(item.photo);
                    System.Net.WebResponse response       = request.GetResponse();
                    System.IO.Stream       responseStream = response.GetResponseStream();
                    Bitmap bitmap = new Bitmap(responseStream);

                    listItem.Image = bitmap;
                }

                flowLayoutPanel1.Controls.Add(listItem);
            }
        }
Example #2
0
        private async void SetLocalization()
        {
            LocalizationWebServiceClient client = new LocalizationWebServiceClient();

            using (new OperationContextScope(client.InnerChannel))
            {
                Program.AddAccessHeaders();
                Localization[] localizationDtos = await getLocalizationListDtoREST();

                foreach (var item in localizationDtos)
                {
                    System.Console.WriteLine(item.id + " " + item.name + " " + item.photo);
                    Form1ListItem listItem = new Form1ListItem();
                    listItem.Title    = item.name;
                    listItem.Subtitle = item.id;

                    if (item.photo != null)
                    {
                        System.Net.WebRequest  request        = System.Net.WebRequest.Create(item.photo);
                        System.Net.WebResponse response       = request.GetResponse();
                        System.IO.Stream       responseStream = response.GetResponseStream();
                        Bitmap bitmap = new Bitmap(responseStream);

                        listItem.Image = bitmap;
                    }
                    flowLayoutPanel1.Controls.Add(listItem);
                }
            }
        }