Invalid components are displayed in ComponentsManagerDlg (up/down bug fixed), etc.
This commit is contained in:
parent
861aae753e
commit
dbfc06960f
@ -3,10 +3,6 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using Config.Resources;
|
||||
using log4net;
|
||||
|
||||
namespace Config.Entities
|
||||
|
||||
@ -53,10 +53,11 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Idx1={2}, ADC-Closed={3}, ADC-Open={4}, StabTm={5}ms, FlowStable={6}s, PosReuse={7}, ReTryCmds={8}",
|
||||
return string.Format("Name={0} ({1}), Idx1={2}, Cat.={3}, ADC-Closed={4}, ADC-Open={5}, StabTm={6}ms, FlowStable={7}s, PosReuse={8}, ReTryCmds={9}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx1,
|
||||
Category,
|
||||
AdcValueClosed,
|
||||
AdcValueOpen,
|
||||
StableTimeMs,
|
||||
|
||||
@ -49,7 +49,7 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Bit={2}, Inv.={3}, Delay={4}s, Cat.={5}, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s",
|
||||
return string.Format("Name={0} ({1}), Bit={2}, Cat.={5}, Inv.={3}, Delay={4}s, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s",
|
||||
Name,
|
||||
string.IsNullOrEmpty(ParentName) ? "-" : ParentName,
|
||||
BitPosition,
|
||||
|
||||
@ -182,19 +182,32 @@ namespace TBF
|
||||
{
|
||||
IComponentCfg cmpCfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt);
|
||||
|
||||
if (cmpCfg != null)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(cmpCfg.Name);
|
||||
lvi.SubItems.Add(cmpCfg.Factory.ClassName);
|
||||
lvi.SubItems.Add(cmpCfg.ParentName);
|
||||
lvi.SubItems.Add(cmpCfg.DebugLevel.ToDescription());
|
||||
lvi.SubItems.Add(cmpCfg.LogLevel.ToDescription());
|
||||
lvi.SubItems.Add(cmpCfg.ToString(1));
|
||||
if (cmpCfg != null)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(cmpCfg.Name);
|
||||
lvi.SubItems.Add(cmpCfg.Factory.ClassName);
|
||||
lvi.SubItems.Add(cmpCfg.ParentName);
|
||||
lvi.SubItems.Add(cmpCfg.DebugLevel.ToDescription());
|
||||
lvi.SubItems.Add(cmpCfg.LogLevel.ToDescription());
|
||||
lvi.SubItems.Add(cmpCfg.ToString(1));
|
||||
|
||||
lvi.Tag = cmpnt;
|
||||
lvi.Tag = cmpnt;
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(cmpnt.Name);
|
||||
lvi.SubItems.Add(string.IsNullOrEmpty(cmpnt.ClassName) ? string.Empty : cmpnt.ClassName);
|
||||
lvi.SubItems.Add(string.IsNullOrEmpty(cmpnt.ParentName) ? string.Empty : cmpnt.ParentName);
|
||||
lvi.SubItems.Add("---");
|
||||
lvi.SubItems.Add("---");
|
||||
lvi.SubItems.Add("Not a component");
|
||||
|
||||
lvi.Tag = cmpnt;
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
@ -342,30 +355,33 @@ namespace TBF
|
||||
if (listViewEx.SelectedIndices.Count != 1) return;
|
||||
ListViewItem lvi = listViewEx.SelectedItems[0];
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
cfgForm.TbfComponents = cmpntEntities;
|
||||
IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Component)lvi.Tag);
|
||||
cfgForm.ComponentCfgCtrl = cfg.GetControl();
|
||||
cfgForm.ComponentCfgCtrl.Config = cfg;
|
||||
DialogResult dr = cfgForm.ShowDialog();
|
||||
if (dr != DialogResult.OK) return;
|
||||
if (cfg != null)
|
||||
{
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
cfgForm.TbfComponents = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfg.GetControl();
|
||||
cfgForm.ComponentCfgCtrl.Config = cfg;
|
||||
DialogResult dr = cfgForm.ShowDialog();
|
||||
if (dr != DialogResult.OK) return;
|
||||
|
||||
flags |= cfgForm.Flags;
|
||||
flags |= cfgForm.Flags;
|
||||
|
||||
sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled
|
||||
unlocked = true; /// in the ComponentParametersDlg.
|
||||
sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled
|
||||
unlocked = true; /// in the ComponentParametersDlg.
|
||||
|
||||
Component modified = cfgForm.Config.CreateDbEntity();
|
||||
Component original = (Component)lvi.Tag;
|
||||
Component modified = cfgForm.Config.CreateDbEntity();
|
||||
Component original = (Component)lvi.Tag;
|
||||
|
||||
original.Name = modified.Name;
|
||||
original.ClassName = modified.ClassName;
|
||||
original.ParentName = modified.ParentName;
|
||||
original.Mode = modified.Mode;
|
||||
original.Logging = modified.Logging;
|
||||
original.Parameters = modified.Parameters;
|
||||
original.Name = modified.Name;
|
||||
original.ClassName = modified.ClassName;
|
||||
original.ParentName = modified.ParentName;
|
||||
original.Mode = modified.Mode;
|
||||
original.Logging = modified.Logging;
|
||||
original.Parameters = modified.Parameters;
|
||||
|
||||
RedrawAll();
|
||||
RedrawAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void upButton_Click(object sender, EventArgs e)
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using log4net;
|
||||
|
||||
namespace Users.Entities
|
||||
@ -117,7 +116,7 @@ namespace Users.Entities
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool Authorize(string userName, string password, Grp.GID requiredGroupMembership)
|
||||
{
|
||||
if (Entities.User.IsPowerUser(userName, password))
|
||||
if (IsPowerUser(userName, password))
|
||||
{
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user