public string Action(string actionName, string actionParameters) { if (MyDriverType == 0) { return(MySSFilterWheel.Action(actionName, actionParameters)); } else { LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); throw new ASCOM.ActionNotImplementedException("Action " + actionName + " is not implemented by this driver"); } }
private void buttonOK_Click(object sender, EventArgs e) { List <Filter> filters = new List <Filter>(); List <string> names = new List <string>(); foreach (Filter f in source.List) { if (f.Name == string.Empty) { continue; } names.Add(f.Name); filters.Add(f); } var dups = names.GroupBy(x => x) .Where(x => x.Count() > 1) .Select(x => x.Key) .ToList(); if (dups.Count > 0) { if (dups.Count > 1) { MessageBox.Show(string.Format("The names \"{0}\" are duplicated!", string.Join(", ", dups.ToArray()))); } else { MessageBox.Show(string.Format("The name \"{0}\" is duplicated!", dups[0])); } return; } _wiseFilterWheel.Action("set-filters-inventory", JsonConvert.SerializeObject(new WiseFilterWheel.SetFilterInventoryParam { FilterSize = _filterSize, Filters = filters.ToArray(), })); Close(); }
private void RefreshWheelInfo() { _currentWheel = JsonConvert.DeserializeObject <WiseFilterWheel.Wheel.WheelDigest>(_wiseFilterWheel.Action("current-wheel", "")); labelCurrentWheelValue.Text = _currentWheel.Name; short position = _currentWheel.CurrentPosition; if (position == -1) { labelCurrentPositionValue.Text = "Unknown"; tableLayoutPanelWheel8.Visible = false; tableLayoutPanelWheel4.Visible = false; return; } labelCurrentPositionValue.Text = (position + 1).ToString(); int nFilters = _currentWheel.Npositions; TableLayoutPanel table = (nFilters == 8) ? tableLayoutPanelWheel8 : tableLayoutPanelWheel4; TableLayoutPanel otherTable = (table == tableLayoutPanelWheel8) ? tableLayoutPanelWheel4 : tableLayoutPanelWheel8; for (int i = 0; i < nFilters; i++) { Label label = (Label)table.Controls.Find(string.Format("label{0}Filter{1}", _currentWheel.Name, i), true)[0]; label.Text = FilterName(_currentWheel.Filters[i].Name); label.ForeColor = (i == position) ? Color.DarkOrange : Color.FromArgb(176, 161, 142); } table.Visible = true; otherTable.Visible = false; }