0

I has the followinng code to make update of more control refers to the same variable on windows form.

I make it to update more than one control by asingle operation on update datatable.

This working very well on Window, calling UpdateControlValue by BeginInvoke.Action from main form. When I execute this code by mono on linux on raspian, it does't work. Thank's for help

DataSet ds = new DataSet();
DataTable tabella1 = new DataTable(TABLE_NAME);
private const string TABLE_NAME = "CostantTable";
private const string COLUMN_NAME = "CtrlName";
private const string COLUMN_VALUE = "CtrlValue";
     
     public HmiMappingManager()
     {            
         tabella1.Columns.Add(COLUMN_NAME, typeof(string));
         tabella1.Columns.Add(COLUMN_VALUE, typeof(string));
         
         var values = Enum.GetValues(typeof(ControlMapEnum));

         foreach (var val in values)
         {
             string defaultValue = DecorationHelper.GetDescription((ControlMapEnum)Enum.Parse(typeof(ControlMapEnum), val.ToString()));
             tabella1.Rows.Add(new object[2] { val.ToString(), defaultValue });
         }

         ds.Tables.Add(tabella1);
         ds.AcceptChanges();
     }
           
     public void AssignConstantToControl(List<System.Windows.Forms.Control> controlToAssociate, ControlMapEnum controlId)
     {           
         BindingSource bs1 = new BindingSource();
         bs1.DataSource = ds;
         bs1.DataMember = TABLE_NAME;
         bs1.Filter = COLUMN_NAME + " = '" + controlId.ToString() + "'";

         foreach (System.Windows.Forms.Control control in controlToAssociate)
             control.DataBindings.Add("Text", bs1, COLUMN_VALUE);

     }
     
   
     public void UpdateControlValue(ControlMapEnum controlId, string newValue)
     {            
             DataRow dr = tabella1.Select(COLUMN_NAME + " = '" + controlId.ToString() + "'").FirstOrDefault();

             if (dr == null)
                 return;

             int index = tabella1.Rows.IndexOf(dr);

             tabella1.Rows[index].BeginEdit();
             tabella1.Rows[index][COLUMN_VALUE] = newValue;
             tabella1.Rows[index].EndEdit();               
             LoggerManagerUtility.Instance.Log(LogLevel.Info, this, "END UPDATE CONTROL" + controlId + " TEXT TO VISUALIZE: " + newValue);

         
     }
      

 ```
2
  • WinForms works "very well on Windows", because it is only supported by Microsoft on Windows. Mono is going away, halfblood.pro/the-end-of-mono so your only choice is to migrate to another UI framework to go cross platform, halfblood.pro/… Commented Aug 16, 2022 at 13:53
  • How dou you suggets? Uno platform is not to ok other? .netcore need of mono... Commented Aug 18, 2022 at 11:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.