private void Params_CellClick(object sender, CellClickEventArgs e) { // Only process the Description column if (e.RowIndex == -1 || startup) { return; } if (e.ColumnIndex == olvColumn2.Index) { var it = ((data)e.Model); var check = it.Value; var name = it.paramname; var availableBitMask = ParameterMetaDataRepository.GetParameterBitMaskInt(name, MainV2.comPort.MAV.cs.firmware.ToString()); if (availableBitMask.Count > 0) { var mcb = new MavlinkCheckBoxBitMask(); var list = new MAVLink.MAVLinkParamList(); list.Add(new MAVLink.MAVLinkParam(name, double.Parse(check.ToString(), CultureInfo.InvariantCulture), MAVLink.MAV_PARAM_TYPE.INT32)); mcb.setup(name, list); mcb.ValueChanged += (o, s, value) => { paramCompareForm_dtlvcallback(s, int.Parse(value)); ((data)e.HitTest.RowObject).Value = value; Params.RefreshItem(e.HitTest.Item); e.HitTest.SubItem.Text = value; Params.CancelCellEdit(); e.Handled = true; mcb.Focus(); }; var frm = mcb.ShowUserControl(); frm.TopMost = true; } } try { string descStr = e.SubItem.ModelValue.ToString(); ConfigRawParams.CheckForUrlAndLaunchInBrowser(descStr); } catch { } }
internal void processToScreen() { toolTip1.RemoveAll(); Params.CancelCellEdit(); Params.Items.Clear(); Params.Objects.ForEach(x => { Params.RemoveObject(x); }); Params.CellEditActivation = ObjectListView.CellEditActivateMode.SingleClick; Params.CanExpandGetter = delegate(object x) { var y = (data)x; if (y.children != null && y.children.Count > 0) { return(true); } return(false); }; Params.ChildrenGetter = delegate(object x) { var y = (data)x; return(new ArrayList(y.children)); }; //Params.Sort(Params.Columns[0], ListSortDirection.Ascending); var sorted = new List <string>(); foreach (string item in MainV2.comPort.MAV.param.Keys) { sorted.Add(item); } sorted.Sort(ComparisonTree); var roots = new List <data>(); var lastroot = new data(); // process hashdefines and update display foreach (var value in sorted) { if (value == null || value == "") { continue; } //System.Diagnostics.Debug.WriteLine("Doing: " + value); var data = new data(); var split = value.Split('_'); data.root = split[0]; data.paramname = value; data.Value = MainV2.comPort.MAV.param[value].ToString(); try { var metaDataDescription = ParameterMetaDataRepository.GetParameterMetaData(value, ParameterMetaDataConstants.Description, MainV2.comPort.MAV.cs.firmware.ToString()); if (!string.IsNullOrEmpty(metaDataDescription)) { var range = ParameterMetaDataRepository.GetParameterMetaData(value, ParameterMetaDataConstants.Range, MainV2.comPort.MAV.cs.firmware.ToString()); var options = ParameterMetaDataRepository.GetParameterMetaData(value, ParameterMetaDataConstants.Values, MainV2.comPort.MAV.cs.firmware.ToString()); var units = ParameterMetaDataRepository.GetParameterMetaData(value, ParameterMetaDataConstants.Units, MainV2.comPort.MAV.cs.firmware.ToString()); data.unit = (units); data.range = (range + options.Replace(",", " ")); data.desc = (metaDataDescription); } if (lastroot.root == split[0]) { lastroot.children.Add(data); } else { var newroot = new data { root = split[0], paramname = split[0] }; newroot.children.Add(data); roots.Add(newroot); lastroot = newroot; } } catch (Exception ex) { log.Error(ex); } } foreach (var item in roots) { // if the child has no children, we dont need the root. if (item.children.Count == 1) { Params.AddObject(item.children[0]); continue; } Params.AddObject(item); } }