/// <summary>Synchronously send the ListGroupItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public IEnumerable <GroupItem> Send(ListGroupItems request)
        {
            var task = SendAsync(request);

            RaiseExceptionOnFault(task);
            return(task.Result);
        }
예제 #2
0
        /// <summary>Synchronously send the ListGroupItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public IEnumerable <GroupItem> Send(ListGroupItems request)
        {
            var task   = Task.Run(async() => await SendAsync(request));
            var result = task.WaitAndUnwrapException();

            return(result);
        }
예제 #3
0
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            ListGroupItems SaveList = new ListGroupItems();

            SaveList.listGroupItem = listGroupItem;

            using (FileStream Stream = new FileStream("userdata/Serialization.xml", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(ListGroupItems));
                xmlSerializer.Serialize(Stream, SaveList);
            }
            System.Diagnostics.Process.GetCurrentProcess().Kill(); // насильно завершаем процесс, если он не завершился самостоятельно
        }
        public void TestListGroupItems()
        {
            ListGroupItems          req;
            Request                 req2;
            IEnumerable <GroupItem> resp;

            // it 'lists set items'
            req  = new ListGroupItems("entity_id");
            resp = client.Send(req);
            Assert.Equal(1, resp.Count());
            Assert.Equal("entity_id", resp.ElementAt(0).ItemId);
            Assert.Equal("item", resp.ElementAt(0).ItemType);
        }
        public async void TestListGroupItems()
        {
            ListGroupItems          req;
            Request                 req2;
            IEnumerable <GroupItem> resp;

            // it 'lists set items'
            req  = new ListGroupItems("entity_id");
            resp = await client.SendAsync(req);

            Assert.Single(resp);
            Assert.Equal("entity_id", resp.ElementAt(0).ItemId);
            Assert.Equal("item", resp.ElementAt(0).ItemType);
        }
        public async void TestListGroupItemsAsync()
        {
            ListGroupItems          req;
            Request                 req2;
            IEnumerable <GroupItem> resp;

            // it 'lists set items'
            req = new ListGroupItems("entity_id");
            System.Threading.Thread.Sleep(10000);
            resp = await client.SendAsync(req);

            Assert.Equal(1, resp.Count());
            Assert.Equal("entity_id", resp.ElementAt(0).ItemId);
            Assert.Equal("item", resp.ElementAt(0).ItemType);
        }
예제 #7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            using (FileStream Stream = new FileStream("userdata/Serialization.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
            {
                XmlSerializer  xmlSerializer = new XmlSerializer(typeof(ListGroupItems));
                ListGroupItems SaveList      = (ListGroupItems)xmlSerializer.Deserialize(Stream);

                foreach (ModelGroupItem modelGroupItem in SaveList.listGroupItem)
                {
                    modelGroupItem.listbox       = listBox;
                    modelGroupItem.listGroupItem = listGroupItem;

                    ViewGroupItem viewGroupItem = new ViewGroupItem(modelGroupItem, viewSettings);
                    modelGroupItem.viewGroupItem = viewGroupItem;
                    modelGroupItem.SetStatus();
                    // Проверяем заполненные поля и выставляем стату готовности к отправке
                    ControllerGroupItem.ChangeGroupItem(modelGroupItem);

                    // Добавляем модель в список моделей и вид в lisBox
                    listGroupItem.Add(modelGroupItem);
                    listBox.Items.Insert(listBox.Items.Count - 1, viewGroupItem);
                }
            }
        }
        /// <summary>Send the ListGroupItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public async Task <IEnumerable <GroupItem> > SendAsync(ListGroupItems request)
        {
            var json = await SendRequestAsync(request).ConfigureAwait(false);

            return(ParseResponse(json, request));
        }
 /// <summary>Parse JSON response</summary>
 /// <param name="json">JSON string from the API</param>
 /// <param name="request">Request sent to the API</param>
 /// <returns>Parsed response</returns>
 protected IEnumerable <GroupItem> ParseResponse(string json, ListGroupItems request)
 {
     return(JsonConvert.DeserializeObject <GroupItem[]>(json));
 }
        /// <summary>Send the ListGroupItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public IEnumerable <GroupItem> Send(ListGroupItems request)
        {
            var json = SendRequest(request);

            return(ParseResponse(json, request));
        }