/// <summary>Synchronously send the ListGroups request</summary> /// <param name="request">Request to be sent</param> /// <returns>Response from the API</returns> public IEnumerable <Group> Send(ListGroups request) { var task = Task.Run(async() => await SendAsync(request)); var result = task.WaitAndUnwrapException(); return(result); }
private void ChooseGroupsForm_Load(object sender, EventArgs e) { int i = 0; ListGroups.Items.Clear(); List <ScheduleGroup> Groups = DictionaryConverter.GroupsToList(ds); foreach (ScheduleGroup group in Groups) { ListGroups.Items.Add(group.Name); ListGroups.SetItemChecked(i, false); i++; } BindingSource bs = new BindingSource(); bs.DataSource = ScheduleView.BasicViews; // cmbProjection.DisplayMember = "Description"; // cmbProjection.ValueMember = "TypeCode"; // cmbProjection.DataSource = bs; // ChooseView = (View)Convert.ToInt32(cmbProjection.SelectedValue); // this.cmbProjection.SelectedIndexChanged += new EventHandler(cmbProjection_SelectedIndexChanged); }
/// <summary>Synchronously send the ListGroups request</summary> /// <param name="request">Request to be sent</param> /// <returns>Response from the API</returns> public IEnumerable <Group> Send(ListGroups request) { var task = SendAsync(request); RaiseExceptionOnFault(task); return(task.Result); }
private void InitUi() { try { curGroups = new List <string> { "The left contact Angle", "Right contact Angle", "Differential contact Angle", "Evaluation contact Angle", "A few lines of inclination", "Minimum contact Angle", "Maximum contact Angle", "The standard deviatio", "Forward contact Angle", "Backward contact Angle", "Lag Angle", "Rolling Angle", "Droplet size", "Droplet diameter" }; foreach (var item in curGroups) { ModuleGroup moduleGroup = new ModuleGroup() { GroupName = item }; ListGroups.Add(moduleGroup); } } catch (Exception) { throw; } }
void cmbProjection_SelectedIndexChanged(object sender, EventArgs e) { // View view = (View)Convert.ToInt32(cmbProjection.SelectedValue); // ChooseView = view; List <string> names = new List <string>(); //switch (view) //{ // case View.Group: names = adapter.NamesGroups; break; // case View.Discipline: names = adapter.NamesDisciplines; break; // case View.Room: names = (from r in Rooms select r.Name).Distinct().ToList(); break; // case View.Teacher: names = adapter.NamesTeachers; break; // default: names = new List<string>(); break; //} int i = 0; ListGroups.Items.Clear(); foreach (string name in names) { ListGroups.Items.Add(name); ListGroups.SetItemChecked(i, true); i++; } }
public ListGroups ListGroups() { ListGroups action = new ListGroups(); action.Client(client); action.Proxy(proxy); return(action); }
public void ResetGroups() { ListGroups.Items.Clear(); ListGroups.DataTextField = "Description"; ListGroups.DataValueField = "id"; ListGroups.DataSource = DatabaseConnection.CreateDataset(String.Format("SELECT * FROM GROUPS WHERE ID<>{0} ORDER BY DESCRIPTION;", UC.UserGroupId)); ListGroups.DataBind(); }
private void FillListGroups() { ListGroups.Items.Clear(); ListGroups.DataTextField = "Description"; ListGroups.DataValueField = "id"; ListGroups.DataSource = DatabaseConnection.CreateDataset("SELECT * FROM GROUPS ORDER BY ID"); ListGroups.DataBind(); }
public void TestListGroups() { ListGroups req; Request req2; IEnumerable <Group> resp; // it 'lists entities' req = new ListGroups(); resp = client.Send(req); Assert.Equal(new Group[] { new Group("entity_id") }, resp); }
public async void TestListGroupsAsync() { ListGroups req; Request req2; IEnumerable <Group> resp; // it 'lists entities' req = new ListGroups(); System.Threading.Thread.Sleep(10000); resp = await client.SendAsync(req); Assert.Equal(new Group[] { new Group("entity_id") }, resp); }
private void InitUi() { try { curGroups = new List <string> { "Circle fitting", "Elliptic fitting", "LY - AP fitting", "LY - SD fitting", "The experimental diagram of contact Angle is automatically fitted", "Manual fitting of contact Angle", "Three point fitting circle", "Five points fit the ellipse", }; foreach (var item in curGroups) { ModuleGroup moduleGroup = new ModuleGroup() { GroupName = item }; ListGroups.Add(moduleGroup); } curGroupsData = new List <string> { "Automatic baseline fitting (default)", "Manually fit the horizontal/tilt baseline", "Manually fitting the surface baseline", "Surface tension", "Automatic fitting test", "The surface tension diagram was fitted automatically", "Wettability analysis", "Surface energy" }; foreach (var item in curGroupsData) { ModuleGroup moduleGroup = new ModuleGroup() { GroupName = item }; ListGroupsData.Add(moduleGroup); } } catch (Exception) { throw; } }
private void RemoveGroup(Group gItem) { try { _cache.RemoveGroup(gItem); if (SelectedGroup == gItem) { SelectedGroup = ListGroups.FirstOrDefault(); } } catch (WebException e) { ShowPopupWebException(e); } }
public ManageGroupsViewModel(ISourcesCacheProvider cacheProvider, IDockWindow window) { _cache = cacheProvider.CurrentCache; _window = window; Title = "Manage Groups"; _cache.Groups .Connect() .Sort(SortExpressionComparer <Group> .Ascending(x => x.ID)) .ObserveOnDispatcher() .Bind(out _listGroups) .Subscribe() .DisposeWith(Disposables); _cache.InstancesWithoutGroup .Connect() .Sort(SortExpressionComparer <Instance> .Ascending(x => x.ID)) .ObserveOnDispatcher() .Bind(out _listWithoutGroup) .Subscribe() .DisposeWith(Disposables); var dynamicInListFilter = this .WhenAnyValue(x => x.SelectedGroup) .Select(g => (Func <Group, bool>)(x => g != null && x.ID == g.ID)); _cache.Groups .Connect() .Filter(dynamicInListFilter) .TransformMany(x => x.Instances, x => x.ID) .Sort(SortExpressionComparer <Instance> .Ascending(x => x.ID)) .ObserveOnDispatcher() .Bind(out _listInGroup) .Subscribe() .DisposeWith(Disposables); SelectedGroup = ListGroups.FirstOrDefault(); RemoveGroupCommand = ReactiveCommand.Create <Group>(RemoveGroup); CreateGroupCommand = ReactiveCommand.CreateFromTask(CreateGroup); }
private void ChooseGroupsForm_Load(object sender, EventArgs e) { int i = 0; ListGroups.Items.Clear(); foreach (string group in adapter.NamesGroups) { ListGroups.Items.Add(group); ListGroups.SetItemChecked(i, true); i++; } BindingSource bs = new BindingSource(); bs.DataSource = ScheduleView.BasicViews; cmbProjection.DisplayMember = "Description"; cmbProjection.ValueMember = "TypeCode"; cmbProjection.DataSource = bs; ChooseView = (ScheduleClasses.View)Convert.ToInt32(cmbProjection.SelectedValue); this.cmbProjection.SelectedIndexChanged += new EventHandler(cmbProjection_SelectedIndexChanged); }
public void Page_Load(object sender, EventArgs e) { if (!Login()) { Response.Redirect("/login.aspx"); } else { DeleteGoBack(); if (!Page.IsPostBack) { FillGrid(); ListGroups.DataTextField = "Description"; ListGroups.DataValueField = "id"; ListGroups.DataSource = DatabaseConnection.CreateDataset("SELECT * FROM GROUPS ORDER BY ID;"); ListGroups.DataBind(); ViewState["IDGroup"] = "-1"; HelpLabel.Text = FillHelp("HelpMenu"); Submit.Text = Root.rm.GetString("Amntxt2"); } } }
/// <summary>Send the ListGroups request</summary> /// <param name="request">Request to be sent</param> /// <returns>Response from the API</returns> public IEnumerable <Group> Send(ListGroups request) { var json = SendRequest(request); 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 <Group> ParseResponse(string json, ListGroups request) { var strArray = JsonConvert.DeserializeObject <string[]>(json); return(strArray.Select(x => new Group(x))); }
/// <summary>Send the ListGroups request</summary> /// <param name="request">Request to be sent</param> /// <returns>Response from the API</returns> public async Task <IEnumerable <Group> > SendAsync(ListGroups request) { var json = await SendRequestAsync(request).ConfigureAwait(false); return(ParseResponse(json, request)); }
/// <summary> /// List all text messages from a memory location /// </summary> /// <param name="Memory">Memory location to read from</param> /// <param name="Group">Group of messages to read</param> /// <param name="Messages">Array of read messages</param> /// <returns>Number of read messages</returns> public int ListTextMessages(String Memory, ListGroups Group, out TextMessage[] Messages) { // Check if Text Messaging was initialized correctly if (!_textmessage_initialized) { throw new GM862Exception(GM862Exception.WRONGARGUMENT); } // Check Memory, must be "ME" or "SM" if (Memory.ToUpper() == "ME") { Memory = "\"ME\""; } if (Memory.ToUpper() == "SM") { Memory = "\"SM\""; } // String used to store response body when executing functions string responseBody; // Get group as string string groupString; // Get group as string switch (Group) { case ListGroups.ALL: groupString = "ALL"; break; case ListGroups.REC_READ: groupString = "REC READ"; break; case ListGroups.REC_UNREAD: groupString = "REC UNREAD"; break; case ListGroups.STO_SEND: groupString = "STO SEND"; break; case ListGroups.STO_UNSEND: groupString = "STO UNSEND"; break; default: groupString = "ALL"; break; } // ArrayList to store read messages System.Collections.ArrayList readMessages = new System.Collections.ArrayList(); // Select memory location if (_device.ExecuteCommand("AT+CPMS=" + Memory, out responseBody, 10000) != AT_Interface.ResponseCodes.OK) { // Error Messages = null; return(0); } // Read Message from Location if (_device.ExecuteCommand("AT+CMGL=\"" + groupString + "\"", out responseBody, 10000) != AT_Interface.ResponseCodes.OK) { // Error Messages = null; return(0); } // Variables used to read message text int messageStart = 0; // Variables used to decode message header System.Collections.ArrayList header = new System.Collections.ArrayList(); String headerPart = ""; bool withinQuote = false; bool ignoreRest = false; bool exitLoop = false; // Keep reading while we have valid listing entries while (responseBody.IndexOf("\r\n+CMGL: ") == 0) { // Start of clean header.Clear(); headerPart = ""; withinQuote = false; ignoreRest = false; // Try reading header parts foreach (char c in responseBody.Substring(9)) { exitLoop = false; switch (c) { case '"': if (withinQuote) { withinQuote = false; ignoreRest = true; break; } if (!withinQuote) { headerPart = ""; withinQuote = true; break; } break; case ',': if (!withinQuote) { ignoreRest = false; header.Add(headerPart); headerPart = ""; break; } break; case '\r': header.Add(headerPart); headerPart = ""; exitLoop = true; break; default: if (!ignoreRest) { headerPart += c; } break; } if (exitLoop) { break; } } // Header should now contain: // [0] Index // [1] Status // [2] Originator // [3] Arrival Time // [4] // [5] Originator Type // [6] Data length // Exit on wrong header if (header.Count < 7) { break; } // Get Message Start messageStart = responseBody.IndexOf("\r\n", 9) + 2; // Build new TextMessage TextMessage newMessage = new TextMessage( Memory, NumberParser.StringToInt((String)header[0]), (String)header[1], (String)header[2], (String)header[3], responseBody.Substring(messageStart, NumberParser.StringToInt((String)header[6])) ); // And add it to the array readMessages.Add(newMessage); // Ok, Next Message responseBody = responseBody.Substring(messageStart + NumberParser.StringToInt((String)header[6])); } // Return read messages Messages = (TextMessage[])readMessages.ToArray(typeof(TextMessage)); return(Messages.Length); }
public void SetGroups(string value) { string[] arryD = value.ToString().Split('|'); string query = String.Empty; ListGroups.Items.Clear(); if (ListGroups.Items.Count <= 0) { ListGroups.DataTextField = "Description"; ListGroups.DataValueField = "id"; ListGroups.DataSource = DatabaseConnection.CreateDataset("SELECT * FROM GROUPS ORDER BY DESCRIPTION;"); ListGroups.DataBind(); } foreach (string ut in arryD) { if (ut.Length > 0) { query += "ID=" + ut + " OR "; } } if (query.Length > 6) { query = "AND (" + query.Substring(0, query.Length - 4) + ")"; } string gquery; if (query.Length > 0) { gquery = "SELECT * FROM GROUPS WHERE " + query.Substring(4) + " ORDER BY DESCRIPTION;"; } else { gquery = "SELECT * FROM GROUPS ORDER BY DESCRIPTION;"; } DataSet ds = DatabaseConnection.CreateDataset(gquery); if (ds.Tables[0].Rows.Count > 0) { ListDip.Items.Clear(); foreach (DataRow dr in ds.Tables[0].Rows) { ListItem li = new ListItem(); li.Value = dr["Id"].ToString(); li.Text = dr["Description"].ToString(); ListDip.Items.Add(li); } ListItem liglobal = new ListItem(); liglobal.Value = "0"; liglobal.Text = "Global"; ListDip.Items.Add(liglobal); if (ListDip.Items.Count > 0) { foreach (ListItem lg in ListGroups.Items) { foreach (ListItem ld in ListDip.Items) { if (ld.Value == lg.Value) { lg.Selected = true; } } } Remove_ListBox(ListGroups); } } else { foreach (ListItem li in ListGroups.Items) { if (li.Value == UC.UserGroupId.ToString()) { li.Selected = true; Transfer_Listbox(ListGroups, ListDip); break; } } } string dep = "|"; foreach (ListItem im in ListDip.Items) { dep += im.Value.ToString() + "|"; } if (dep.Length < 2) { dep = "|" + UC.UserGroupId.ToString() + "|"; } if (dep.IndexOf("|" + UC.AdminGroupId + "|") < 0) { dep = "|" + UC.AdminGroupId + dep; } GroupValue.Value = dep; }
private void Save() { var dd = ListGroups.Where(s => s.Check); }