Пример #1
0
 /// <summary>
 /// Initializes the control.
 /// </summary>
 public void Init(IAdminContext adminContext, ScadaProject project)
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.project      = project ?? throw new ArgumentNullException(nameof(project));
     lastStartCnlNum   = 1;
     lastCnlCnt        = 0;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmCnlClone(IAdminContext adminContext, ConfigDatabase configDatabase)
     : this()
 {
     this.adminContext   = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.configDatabase = configDatabase ?? throw new ArgumentNullException(nameof(configDatabase));
     ChannelsCloned      = false;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public CtrlLineSelect(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection)
     : this()
 {
     this.adminContext    = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.project         = project ?? throw new ArgumentNullException(nameof(project));
     this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection));
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmModules(IAdminContext adminContext, ServerApp serverApp)
     : this()
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.serverApp    = serverApp ?? throw new ArgumentNullException(nameof(serverApp));
     serverConfig      = serverApp.AppConfig;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmCnlCreate(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection)
     : this()
 {
     this.adminContext    = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.project         = project ?? throw new ArgumentNullException(nameof(project));
     this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection));
     step = 1;
 }
Пример #6
0
        private ChannelConfig channelConfigCopy;                         // the edited copy of the communication channel configuration


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public CtrlLineMain()
        {
            InitializeComponent();
            adminContext      = null;
            commApp           = null;
            changing          = false;
            channelConfigCopy = null;
        }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmGeneralOptions(IAdminContext adminContext, ServerApp serverApp)
     : this()
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.serverApp    = serverApp ?? throw new ArgumentNullException(nameof(serverApp));
     serverConfig      = serverApp.AppConfig;
     changing          = false;
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public CtrlMainMenu(IAdminContext adminContext)
     : this()
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     SetMenuItemsEnabled();
     adminContext.CurrentProjectChanged += AdminContext_CurrentProjectChanged;
     adminContext.MessageToExtension    += AdminContext_MessageToExtension;
 }
Пример #9
0
        private readonly RichTextBoxHelper logHelper; // provides access to log


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public ConfigBuilder(IAdminContext adminContext, ScadaProject project, RichTextBoxHelper logHelper)
        {
            this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
            this.project      = project ?? throw new ArgumentNullException(nameof(project));
            this.logHelper    = logHelper ?? throw new ArgumentNullException(nameof(logHelper));

            BuildResult   = false;
            DeviceConfigs = new List <DeviceConfigEntry>();
        }
Пример #10
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public CtrlExtensionMenu(IAdminContext adminContext)
            : this()
        {
            this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
            recentSelection   = new RecentSelection();

            SetMenuItemsEnabled();
            adminContext.CurrentProjectChanged += AdminContext_CurrentProjectChanged;
        }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmArchives(IAdminContext adminContext, ServerApp serverApp)
     : this()
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.serverApp    = serverApp ?? throw new ArgumentNullException(nameof(serverApp));
     serverConfig      = serverApp.AppConfig;
     changing          = false;
     archiveClipboard  = null;
     SetColumnNames();
 }
Пример #12
0
        /// <summary>
        /// Initializes the control.
        /// </summary>
        public void Init(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection)
        {
            this.adminContext    = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
            this.project         = project ?? throw new ArgumentNullException(nameof(project));
            this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection));

            CnlPrototypes = null;
            ScanCommSettings();
            FillCommLineList();
        }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmLineConfig(IAdminContext adminContext, CommApp commApp, LineConfig lineConfig)
     : this()
 {
     this.adminContext  = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.commApp       = commApp ?? throw new ArgumentNullException(nameof(commApp));
     this.lineConfig    = lineConfig ?? throw new ArgumentNullException(nameof(lineConfig));
     mainOptionsReady   = false;
     customOptionsReady = false;
     devicePollingReady = false;
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmDataSources(IAdminContext adminContext, CommApp commApp)
     : this()
 {
     this.adminContext   = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.commApp        = commApp ?? throw new ArgumentNullException(nameof(commApp));
     commConfig          = commApp.AppConfig;
     changing            = false;
     dataSourceClipboard = null;
     SetColumnNames();
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmTableEditor(IAdminContext adminContext, string fileName)
     : this()
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     configDatabase    = adminContext.CurrentProject?.ConfigDatabase ??
                         throw new ScadaException("Configuration database must not be null.");
     tableView         = new TableView(new Data.Entities.View());
     this.fileName     = fileName ?? throw new ArgumentNullException(nameof(fileName));
     preventNodeExpand = false;
 }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public FrmRegistration(IAdminContext adminContext, ProjectApp projectApp,
                               string productCode, string productName) : this()
        {
            this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
            this.productCode  = productCode ?? throw new ArgumentNullException(nameof(productCode));
            this.projectApp   = projectApp ?? throw new ArgumentNullException(nameof(projectApp));
            regKeyFileName    = Path.Combine(projectApp.ConfigDir, productCode + "_Reg.xml");

            txtProductName.Text = productName;
        }
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public FrmDeviceCommand(IAdminContext adminContext, DeviceConfig deviceConfig)
            : this()
        {
            this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
            this.deviceConfig = deviceConfig ?? throw new ArgumentNullException(nameof(deviceConfig));
            AgentClient       = null;

            FormTranslator.Translate(this, GetType().FullName);
            Text             = string.Format(Text, CommUtils.GetDeviceTitle(deviceConfig));
            rbNumVal.Checked = true;
        }
Пример #18
0
        private DeviceConfig deviceClipboard; // contains the copied device


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public CtrlLinePolling()
        {
            InitializeComponent();
            numNumAddress.Maximum = int.MaxValue;

            SetColumnNames();
            adminContext    = null;
            commApp         = null;
            lineConfig      = null;
            changing        = false;
            deviceClipboard = null;
        }
Пример #19
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public FrmSync(IAdminContext adminContext, ScadaProject project, CommApp commApp)
            : this()
        {
            this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
            this.project      = project ?? throw new ArgumentNullException(nameof(project));
            this.commApp      = commApp ?? throw new ArgumentNullException(nameof(commApp));
            commConfig        = commApp.AppConfig;
            lastErrorMessage  = "";

            SelectedLineNum = 0;
            AddedToComm     = false;
        }
Пример #20
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmDeviceData(IAdminContext adminContext, CommApp commApp, DeviceConfig deviceConfig) :
     this()
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.commApp      = commApp ?? throw new ArgumentNullException(nameof(commApp));
     this.deviceConfig = deviceConfig ?? throw new ArgumentNullException(nameof(deviceConfig));
     dataBox           = new RemoteLogBox(lbDeviceData)
     {
         FullLogView = true
     };
     frmDeviceCommand = null;
     isClosed         = false;
 }
Пример #21
0
 public InitialisationHandler(IFilmContext filmRepo, ReviewFilter reviewRepo, CommentFilter commentRepo, ShowingService showRepo,
                              ICustomerContext userRepo, IAdminContext adminRepo, IAccessTokenContext accessTokenContext,
                              AccountCreationService accountCreationService, ExistingUserService existingUserService)
 {
     _filmRepo               = filmRepo;
     _reviewHandler          = reviewRepo;
     _commentRepo            = commentRepo;
     _showRepo               = showRepo;
     _userRepo               = userRepo;
     _adminRepo              = adminRepo;
     _accessTokenContext     = accessTokenContext;
     _existingUserService    = existingUserService;
     _accountCreationService = accountCreationService;
 }
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmLineStats(IAdminContext adminContext, LineConfig lineConfig)
     : this()
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.lineConfig   = lineConfig ?? throw new ArgumentNullException(nameof(lineConfig));
     stateBox          = new RemoteLogBox(lbState)
     {
         FullLogView = true
     };
     logBox = new RemoteLogBox(lbLog, true)
     {
         AutoScroll = true
     };
     stateTabActive = true;
     isClosed       = false;
 }
Пример #23
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public FrmDeviceAdd(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection)
            : this()
        {
            this.adminContext    = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
            this.project         = project ?? throw new ArgumentNullException(nameof(project));
            this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection));

            Instance     = null;
            DeviceConfig = null;
            LineConfig   = null;

            numDeviceNum.Maximum    = ConfigDatabase.MaxID;
            txtName.MaxLength       = ExtensionUtils.NameLength;
            txtStrAddress.MaxLength = ExtensionUtils.DefaultLength;
            txtDescr.MaxLength      = ExtensionUtils.DescrLength;
        }
Пример #24
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public FrmWirenBoardWizard(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection)
            : this()
        {
            this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
            this.project      = project ?? throw new ArgumentNullException(nameof(project));

            ctrlLineSelect = new CtrlLineSelect(adminContext, project, recentSelection);
            ctrlLog        = new CtrlLog();
            ctrlDeviceTree = new CtrlDeviceTree();
            ctrlEntityID   = new CtrlEntityID(adminContext, project, recentSelection);
            logHelper      = new RichTextBoxHelper(ctrlLog.RichTextBox);
            AddUserControls();

            step          = Step.SelectLine;
            topicReader   = null;
            configBuilder = null;
        }
Пример #25
0
        /// <summary>
        /// Gets a new instance of the device user interface.
        /// </summary>
        public static bool GetDeviceView(IAdminContext adminContext, CommApp commApp, DeviceConfig deviceConfig,
                                         out DeviceView deviceView, out string errMsg)
        {
            ArgumentNullException.ThrowIfNull(adminContext, nameof(adminContext));
            ArgumentNullException.ThrowIfNull(commApp, nameof(commApp));
            ArgumentNullException.ThrowIfNull(deviceConfig, nameof(deviceConfig));
            deviceView = null;

            if (string.IsNullOrEmpty(deviceConfig.Driver))
            {
                errMsg = ExtensionPhrases.DriverNotSpecified;
                return(false);
            }
            else if (!GetDriverView(adminContext, commApp, deviceConfig.Driver,
                                    out DriverView driverView, out errMsg))
            {
                return(false);
            }
Пример #26
0
        /// <summary>
        /// Gets a new instance of the module user interface.
        /// </summary>
        public static bool GetModuleView(IAdminContext adminContext, ServerApp serverApp, string moduleCode,
                                         out ModuleView moduleView, out string message)
        {
            ArgumentNullException.ThrowIfNull(adminContext, nameof(adminContext));
            ArgumentNullException.ThrowIfNull(serverApp, nameof(serverApp));

            if (ModuleFactory.GetModuleView(adminContext.AppDirs.LibDir, moduleCode, out moduleView, out message))
            {
                moduleView.ConfigDataset = adminContext.CurrentProject.ConfigDatabase;
                moduleView.AppDirs       = adminContext.AppDirs.CreateDirsForView(serverApp.ConfigDir);
                moduleView.AppConfig     = serverApp.AppConfig;
                moduleView.LoadDictionaries();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #27
0
        /// <summary>
        /// Gets a new instance of the module user interface.
        /// </summary>
        public static bool GetDriverView(IAdminContext adminContext, CommApp commApp, string driverCode,
                                         out DriverView driverView, out string message)
        {
            ArgumentNullException.ThrowIfNull(adminContext, nameof(adminContext));
            ArgumentNullException.ThrowIfNull(commApp, nameof(commApp));

            if (DriverFactory.GetDriverView(adminContext.AppDirs.LibDir, driverCode, out driverView, out message))
            {
                driverView.ConfigDataset = adminContext.CurrentProject.ConfigDatabase;
                driverView.AppDirs       = adminContext.AppDirs.CreateDirsForView(commApp.ConfigDir);
                driverView.AgentClient   = adminContext.MainForm.GetAgentClient(false);
                driverView.AppConfig     = commApp.AppConfig;
                driverView.LoadDictionaries();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #28
0
        /// <summary>
        /// Gets a new instance of the extension logic.
        /// </summary>
        public static bool GetExtensionLogic(string directory, string extensionCode, IAdminContext adminContext,
                                             out ExtensionLogic extensionLogic, out string message)
        {
            string fileName = Path.Combine(directory, extensionCode + ".dll");
            string typeName = string.Format("Scada.Admin.Extensions.{0}.{0}Logic", extensionCode);

            try
            {
                if (File.Exists(fileName))
                {
                    Assembly assembly = Assembly.LoadFrom(fileName);
                    Type     type     = assembly.GetType(typeName, true);
                    extensionLogic = (ExtensionLogic)Activator.CreateInstance(type, adminContext);

                    message = string.Format(Locale.IsRussian ?
                                            "Расширение {0} {1} загружено из файла {2}" :
                                            "Extension {0} {1} loaded from file {2}",
                                            extensionCode, assembly.GetName().Version, fileName);
                    return(true);
                }
                else
                {
                    extensionLogic = null;
                    message        = string.Format(Locale.IsRussian ?
                                                   "Невозможно создать логику расширения {0}. Файл {1} не найден" :
                                                   "Unable to create extension logic {0}. File {1} not found", extensionCode, fileName);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                extensionLogic = null;
                message        = string.Format(Locale.IsRussian ?
                                               "Ошибка при создании логики расширения {0} типа {1} из файла {2}: {3}" :
                                               "Error creating extension logic {0} of type {1} from file {2}: {3}",
                                               extensionCode, typeName, fileName, ex.Message);
                return(false);
            }
        }
Пример #29
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmCommLogs(IAdminContext adminContext)
     : base(adminContext)
 {
     ServiceApp = ServiceApp.Comm;
 }
 public ExistingUserService(ICustomerContext customerContext, SecurityService securityService, IAdminContext adminContext)
 {
     _customerContext = customerContext;
     _securityService = securityService;
     _adminContext    = adminContext;
 }