private void MaintenanceFactorRefresh(object sender, EventArgs e)
        {
            if (sender is List <string> li)
            {
                if (Int32.Parse(li[0]) == ControllerIdx && Connected)
                {
                    MaintenanceFactor.Clear();
                    MaintenanceFactor.AddRange(li);

                    foreach (Control c in maintenanceFactorPanel.Controls)
                    {
                        if (c.GetType() == typeof(BunifuCustomLabel) &&
                            c.Name.Contains("maintenanceFactorLabel"))
                        {
                            int levelIndex = Int32.Parse(c.Name.Remove(0, "maintenanceFactorLabel".Length));
                            try
                            {
                                Invoke(new Action(() =>
                                {
                                    c.Text = MaintenanceFactor[levelIndex];
                                }));
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine($"MaintenanceFactorRefresh: {ex}");
                                return;
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void Apply_Click(object sender, EventArgs e)
        {
            MaintenanceFactor.Clear();
            MaintenanceFactor.AddRange(new string[maintenanceFactorPanel.ColumnCount + 1]);

            foreach (Control c in maintenanceFactorPanel.Controls)
            {
                if (c.GetType() == typeof(BunifuMaterialTextbox) &&
                    c.Name.Contains("maintenanceFactorTextBox"))
                {
                    int levelIndex = Int32.Parse(c.Name.Remove(0, "maintenanceFactorTextBox".Length));
                    MaintenanceFactor[levelIndex] = c.Text;
                }
            }

            MaintenanceFactor[0] = ControllerIdx.ToString();

            UserChangedMaintenanceFactor?.Invoke(this, e);

            Close();
        }