public AudioMixerPlayerOperativeControl(Device device, IPlayerCommand playerProvider, IEventLogging logging)
     : this()
 {
     _countSwitch = 0;
     InitializeController(new AudioMixerPlayerController(device, playerProvider, this, logging));
     SetControlPlayerTimerEnable(true, 3000);
 }
예제 #2
0
 public ServerConfiguration(ModuleLoader loader, IEventLogging logging)
     : base(loader, true, logging)
 {
     string path = Path.GetFullPath(Settings.Default.UserStorageFolder);
     path = Path.Combine(path, UserStorageFile);
     UserStorageAdapter.Instance.Init(path);
 }
예제 #3
0
 public static MemoryStream GetScreenShort(IEventLogging log, Guid imageFormat)
 {
     MemoryStream result = null;
     try
     {
         result = new MemoryStream(ScreeBufferSize);
         Size sz = Screen.PrimaryScreen.Bounds.Size;
         IntPtr hDesk = GetDesktopWindow();
         IntPtr hSrce = GetWindowDC(hDesk);
         IntPtr hDest = CreateCompatibleDC(hSrce);
         IntPtr hBmp = CreateCompatibleBitmap(hSrce, sz.Width, sz.Height);
         IntPtr hOldBmp = SelectObject(hDest, hBmp);
         bool b = BitBlt(hDest, 0, 0, sz.Width, sz.Height, hSrce, 0, 0, CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt);
         using (Image image = Image.FromHbitmap(hBmp))
         {
             SelectObject(hDest, hOldBmp);
             DeleteObject(hBmp);
             DeleteDC(hDest);
             ReleaseDC(hDesk, hSrce);
             image.Save(result, new ImageFormat(imageFormat));
         }
     }
     catch (Exception ex)
     {
         log.WriteError(ex.Message);
     }
     return result;
 }
예제 #4
0
        private static List<IModule> loadInstanceFromAssembly(IEnumerable<string> fileList, IEventLogging logging)
        {
            List<IModule> result = new List<IModule>(8);
            StringBuilder message = new StringBuilder(InfoMesage);
            foreach (string fileName in fileList)
            {
                Assembly assembly = Assembly.LoadFrom(fileName);
                object[] list = assembly.GetCustomAttributes(typeof(ModuleAttribute), false);
                foreach (ModuleAttribute attr in list)
                {
                    IModule module = (IModule)assembly.CreateInstance(attr.ModuleType.FullName);
                    module.Name = attr.Name;
                    result.Add(module);
                }

                message.AppendFormat(CultureInfo.InvariantCulture,
                                     ModuleInfoFormat,
                                     Environment.NewLine,
                                     assembly.Location,
                                     Environment.NewLine,
                                     assembly.FullName);
            }
            logging.WriteInformation(message.ToString());
            return result;
        }
예제 #5
0
        internal static LabelStorage LoadStorage(string file, List<Label> systemLabels, IEventLogging logging)
        {
            string xmlPath = file;
            string xsdPath = Path.ChangeExtension(file, "xsd");

            XmlSerializer serializer = new XmlSerializer(typeof(LabelStorage));
            XmlReaderSettings settings = new XmlReaderSettings();
            settings.ValidationType = ValidationType.Schema;
            settings.Schemas.Add("urn:labelstorage-schema", xsdPath);
            LabelStorage storage = null;
            //settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
            using (XmlReader reader = XmlReader.Create(xmlPath, settings))
            {
                storage = (LabelStorage)serializer.Deserialize(reader);
            }
            // теперя надо проверить, что нет пользовательских меток, совпадающих с системными. если есть - пользовательские надо удалять
            List<Label> toRemove = storage.FindAll(
                label =>
                systemLabels.Any(
                    syslab =>
                    syslab.Id == label.Id || syslab.Name.Equals(label.Name, StringComparison.InvariantCultureIgnoreCase)));
            foreach (Label item in toRemove)
            {
                logging.WriteWarning(string.Format("Пользовательская метка <{0}> удалена ввиду конфликта названия или идентификатора с одноименной системной меткой", item.Name));
            }
            storage.RemoveAll(label=>toRemove.Any(tor => object.ReferenceEquals(tor, label)));
            // и оптяь сохраним
            storage.SaveStorage(file);
            return storage;
        }
예제 #6
0
 public override Control CreateControlForSource(IEventLogging logging, Source source, Control parent, IPlayerCommand playerCommand, IPresentationClient client)
 {
     VDCTerminalControl control = new VDCTerminalControl(source, playerCommand, logging, client);
     control.Parent = parent;
     parent.Controls.Add(control);
     control.CreateControl();
     return control;
 }
예제 #7
0
 public override System.Windows.Forms.Control CreateControlForSource(IEventLogging logging, Source source, Control parent, IPlayerCommand playerCommand, IPresentationClient client)
 {
     DVDPlayerControl2 control = new DVDPlayerControl2(source, playerCommand, logging, client);
     control.Parent = parent;
     parent.Controls.Add(control);
     control.CreateControl();
     return control;
 }
예제 #8
0
 public CommonConfiguration(ModuleLoader loader, ModuleConfiguration configuration, IEventLogging logging)
 {
     this.loader = loader;
     this._logging = logging;
     _config = configuration;
     _labelStorageAdapter = CreateLabelStorageAdapter(configuration);
     _systemParametersAdapter = new SystemParametersAdapter();
 }
예제 #9
0
 public override Control CreateControlForDevice(IEventLogging logging, Device device, Control parent, IPlayerCommand playerProvider, IPresentationClient client)
 {
     LightPlayerControl control = new LightPlayerControl(device, playerProvider, logging);
     control.Parent = parent;
     parent.Controls.Add(control);
     control.CreateControl();
     return control;
 }
예제 #10
0
 public LightPlayerControl(Device device, IPlayerCommand playerProvider, IEventLogging logging)
     : this()
 {
     _countSwitch = 0;
     _lightGroups = new Dictionary<string, int>();
     InitializeController(new LightPlayerController(device, playerProvider, this, logging));
     SetControlPlayerTimerEnable(true, 3000);
 }
예제 #11
0
 public override System.Windows.Forms.Control CreateControlForSource(IEventLogging logging, TechnicalServices.Persistence.SystemPersistence.Presentation.Source source, System.Windows.Forms.Control parent, IPlayerCommand playerCommand, IPresentationClient client)
 {
     PlayerController controller = new PlayerController(source, playerCommand);
     VNCPlayerControl control = new VNCPlayerControl(controller);
     control.Parent = parent;
     parent.Controls.Add(control);
     control.CreateControl();
     return control;
 }
예제 #12
0
 public AgentManager(IEventLogging logging)
 {
     _logging = logging;
     _flag = new AutoResetEvent(false);
     _proc = new Thread(ThreadProc);
     _backgroundProvider = new BackgroundProvider();
     _proc.Start(_flag);
     _flag.WaitOne(-1);
 }
예제 #13
0
 public override Control CreateControlForSource(IEventLogging logging, Source source, Control parent, IPlayerCommand playerProvider, IPresentationClient client)
 {
     PlayerController controller = new PlayerController(source, playerProvider);
     PlayerControl control = new PlayerControl(controller);
     control.Parent = parent;
     parent.Controls.Add(control);
     control.CreateControl();
     return control;
 }
예제 #14
0
 public LabelStorageAdapter(ModuleConfiguration config, string path, IEventLogging logging)
     : this(config, logging)
 {
     _filePath = path;
     LabelStorage customLabelStorage = LabelStorageExt.LoadStorage(path, config.LabelList, logging);
     _labelStorage.AddRange(customLabelStorage);
     _lastLabelId = (_labelStorage.Count > 0) ? _labelStorage.Max(x => x.Id) : 0;
     Check();
 }
예제 #15
0
 public AdministrationForm(IEventLogging logging) : this()
 {
     ILabelStorageAdapter labelStorageAdapter = new LabelStorageAdapter(null, logging);
     this._controller = new UserListController(this, gridUserParametrs);
     this._labelController = new LabelListController(this, gridUserParametrs);
     this._systemParametersController = new SystemParametersController(this, gridSystemParameters);
     SystemParametersController.Instance.OnSystemParametersCellChenged += new SystemParametersCellChenged(AdministrationForm_OnSystemParametersCellChenged);
     UserGridVisibility();
 }
예제 #16
0
 public LabelStorageAdapter(ModuleConfiguration config, IEventLogging logging)
 {
     //удаленная загрузка OnLine
     _logging = logging;
     if (config == null) return;
     _labelStorage.AddRange(config.LabelList);
     _lastLabelId = (_labelStorage.Count > 0) ? _labelStorage.Max(x => x.Id) : 0;
     _syncObject = ((ICollection)lockedLabels).SyncRoot;
     Check();
 }
예제 #17
0
        public VDCTerminalControl(Source source, IPlayerCommand playerCommand, IEventLogging logging, IPresentationClient client)
            : this()
        {
            CollapsedRGBOption = true;
            cbaAbonents.DisplayMember = "Name";
            cbaAbonents.ValueMember = "Number1";

            _controller = new PlayerController(client, source, this, playerCommand, logging);
            InitializeController(_controller);
            SetControlPlayerTimerEnable(true, 1000);
        }
 public static IExternalSystemCommand CreateController(string fullClassName, Uri connectionString, IEventLogging logging)
 {
     string[] list = fullClassName.Split(',');
     if (list.Length != 2)
         throw new ApplicationException("Неправильно указана библиотека для работы с контроллером внешней системы");
     Assembly asm = AppDomain.CurrentDomain.Load(list[0]);
     Type classType = asm.GetType(list[1]);
     IExternalSystemCommand result =
         (IExternalSystemCommand)Activator.CreateInstance(classType, connectionString, logging);
     return result;
 }
예제 #19
0
 public static IControllerChannel CreateController(IEventLogging logging, string fullClassName, Uri parameter, int receiveTimeout,
                                                   int checkTimeout)
 {
     string[] list = fullClassName.Split(',');
     if (list.Length != 2)
         throw new ApplicationException("Неправильно указана библиотека для работы с контроллером");
     Assembly asm = AppDomain.CurrentDomain.Load(list[0]);
     Type classType = asm.GetType(list[1]);
     IControllerChannel result =
         (IControllerChannel) Activator.CreateInstance(classType, logging, parameter, receiveTimeout, checkTimeout);
     return result;
 }
예제 #20
0
        //private readonly LockingNotifier _notifier = new LockingNotifier();

        public LockingService(UserIdentity systemUser, IEventLogging log)
        {
            _systemUser = systemUser;
            _log = log;
            _timer = new Timer(_interval);
            _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
            _timer.Start();
            _lockingStorage = new LockingStorage();
            _lockingStorage.OnAddItem += _lockingStorage_OnAddItem;
            _lockingStorage.OnRemoveItem += _lockingStorage_OnRemoveItem;
            //_lockingStorage.OnAddItem += new TechnicalServices.Common.StorageAction<ObjectKey, LockingInfo>(_notifier.SubscribeForMonitor);
            //_lockingStorage.OnRemoveItem +=new TechnicalServices.Common.StorageAction<ObjectKey,LockingInfo>(_notifier.UnSubscribeForMonitor);
        }
예제 #21
0
        public ModuleLoader(IEventLogging logging)
        {
            Debug.Assert(logging != null, "Нет системы логирования");
            _logService = logging;

            string path = Path.GetFullPath(Settings.Default.ModuleFolder);
            if (!Directory.Exists(path))
                _logService.WriteWarning(String.Format(LoadingWarning, path));

            string[] fileList = Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories);
            IEnumerable<string> libraryList = getFilesByAttribyte(fileList);
            _moduleList = loadInstanceFromAssembly(libraryList, logging);
        }
예제 #22
0
        public TcpExternalSystemServer(Uri connectionString, IEventLogging log)
        {
            Debug.Assert(connectionString.Scheme == "tcp");
            Debug.Assert(connectionString.Port != 0);

            _log = log;
            _encoding = Encoding.Default;
            _connectionString = connectionString;
            _exit = new ManualResetEvent(false);
            _thread = new Thread(ThreadProc);
            _thread.Start();

        }
예제 #23
0
 public override Control CreateControlForSource(IEventLogging logging, Source source, Control parent, IPlayerCommand playerProvider, IPresentationClient client)
 {
     ArcGISMapController controller = new ArcGISMapController(source, playerProvider);
     //ChartManageControl control = new ChartManageControl(controller);
     //control.Parent = parent;
     //parent.Controls.Add(control);
     //control.CreateControl();
     MapManageControl control = new MapManageControl(controller);
     control.Parent = parent;
     parent.Controls.Add(control);
     control.CreateControl();
     return control;
 }
예제 #24
0
 public DVDPlayerControl2(Source source, IPlayerCommand playerCommand, IEventLogging logging, IPresentationClient client)
     : this()
 {
     InitializeController(new PlayerController(client, source, this, playerCommand, logging));
     switch (_DVDType)
     {
         case InterfaceTypeEnum.IR:
             SetControlPlayerTimerEnable(false, 1);
             break;
         case InterfaceTypeEnum.RS232:
             SetControlPlayerTimerEnable(true, 1000);
             break;
     }
 }
예제 #25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="loader"></param>
        /// <param name="checkModules"></param>
        /// <param name="logging"></param>
        /// <param name="notThrowExceptionIfInvalideConfiguration"> используется ТОЛЬКО для дизайнера в автономном режиме</param>
        public CommonConfiguration(ModuleLoader loader, bool checkModules, IEventLogging logging, bool notThrowExceptionIfInvalideConfiguration)
        {
            this.loader = loader;
            this._logging = logging;
            string labelStoragePath;
            string moduleConfigFile = String.Empty;
            string configurationSchemaFile;
            try
            {
                string moduleConfigPath = labelStoragePath = Path.GetFullPath(ConfigurationFolder);
                moduleConfigFile = Path.Combine(moduleConfigPath, ConfigurationFile);
                labelStoragePath = Path.Combine(labelStoragePath, LabelFile);
                configurationSchemaFile = Path.Combine(moduleConfigPath, ConfigurationSchemaFile);
            }
            catch (ArgumentException ex)
            {
                throw new ModuleConfigurationException(moduleConfigFile);
            }

            try
            {
                _config = LoadModuleConfiguration(moduleConfigFile, configurationSchemaFile, this.loader.ModuleList);
                if (checkModules) CheckLoadedModules();
            }
            catch(Exception ex)
            {
                if (notThrowExceptionIfInvalideConfiguration)
                {
                    _config = new InvalideModuleConfiguration() {ErrorMessage = ex.Message, InnerException = ex};
                }
                else
                {
                    throw;
                }
            }

            _systemParametersAdapter = new SystemParametersAdapter();
            _labelStorageAdapter = CreateLabelStorageAdapter(_config, labelStoragePath);
        }
예제 #26
0
 public virtual Control CreateControlForSource(IEventLogging logging, Source source, Control parent, IPlayerCommand playerProvider, IPresentationClient client)
 {
     return null;
 }
예제 #27
0
 public AgentConfiguration(ModuleLoader loader, ModuleConfiguration configuration, IEventLogging logging)
     : base(loader, configuration, logging)
 {
 }
 public VideoCameraPlayerCommonControl(Source source, IPlayerCommand playerCommand, IEventLogging logging, IPresentationClient client)
     : this()
 {
     InitializeController(new VideoCameraPlayerCommonController(client, source, this, playerCommand, logging));
     SetControlPlayerTimerEnable(true, 1000);
 }
예제 #29
0
 public bool Init(IEventLogging log)
 {
     Debug.Assert(log != null, "IEventLogging не может быть null");
     return true;
 }
예제 #30
0
 public virtual Control CreateControlForDisplay(IEventLogging logging, Display display, Control parent, IPlayerCommand playerProvider, IPresentationClient client)
 {
     return null;
 }