コード例 #1
0
 public static IResourceCRUD CreateClientFileTransfer(bool isStandAlone, IResourceRemoteCRUD contract, ISourceDAL sourceDAL)
 {
     if (isStandAlone)
         return new ClientSideStandAloneFileTransfer(sourceDAL);
     else
     {
         return new ClientSideFileTransfer(contract);
     }
 }
コード例 #2
0
        public RemotePresentationClient(IPresentationNotifier presentationNotifier,
            IClientConfiguration clientConfiguration, ISourceDAL sourceDAL, IDeviceSourceDAL deviceSourceDAL)
        {
            _sourceDAL = sourceDAL;
            _deviceSourceDAL = deviceSourceDAL;
            _presentationNotifier = presentationNotifier;
            _configuration = clientConfiguration;
            _presentationClient = new DuplexClient<IPresentationService>(new InstanceContext(presentationNotifier),
                clientConfiguration.PingInterval);
            _presentationClient.Open();
            _presentationClient.OnChanged += new EventHandler<ClientState>(_presentationClient_OnChanged);

            _deviceDescriptorCache = new DeviceDescriptorCache(presentationNotifier);
        }
コード例 #3
0
 public override Presentation GetPresentation(string uniqueName, ISourceDAL sourceDAL, IDeviceSourceDAL deviceSourceDAL, out string[] deletedElements)
 {
     _sync.AcquireReaderLock(Timeout.Infinite);
     try
     {
         ObjectKey key = ObjectKeyCreator.CreatePresentationKey(uniqueName);
         Presentation presentation = _cache.Read(key);
         if (presentation != null)
         {
             try
             {
                 DeviceResourceDescriptor[] deviceResourceDescriptors =
                     deviceSourceDAL.GetGlobalSources().SelectMany(kv => kv.Value).ToArray();
                 // если презентация взята из кэша, нужно обновить ссылки
                 deletedElements =  presentation.InitReference(_configuration.ModuleConfiguration, _configuration.LabelStorageAdapter.GetLabelStorage(),
                                            GetDescriptorsForLoadPresentation(sourceDAL, presentation.UniqueName).ToArray(),
                                                deviceResourceDescriptors);
                 if (deletedElements != null && deletedElements.Length != 0)
                 {
                     string output = deletedElements.Aggregate((cur, next) => cur + ", " + next);
                     _configuration.EventLog.WriteWarning(
                         string.Format(
                             "При инициализации сценария {0} не было обнаружено в конфигурации следующее оборудование:\n {1}",
                             presentation.Name, output));
                 }
                 return presentation;
             }
             catch (Exception ex)
             {
                 _configuration.EventLog.WriteError(string.Format("PresentationDALCaching.GetPresentation: uniqueName: {0} \n{1}", uniqueName, ex));
             }
         }
         presentation = base.GetPresentation(uniqueName, sourceDAL, deviceSourceDAL, out deletedElements);
         if (presentation != null) _cache.Add(key, presentation);
         return presentation;
     }
     finally
     {
         _sync.ReleaseReaderLock();
     }
 }
コード例 #4
0
ファイル: DesignerClient.cs プロジェクト: AlexSneg/VIRD-1.0
 public void Initialize(IClientConfiguration configuration, bool isStandAlone)
 {
     _configuration = configuration;
     IsStandAlone = isStandAlone;
     _sourceDAL = new SourceDALCaching(_configuration, isStandAlone);
     _deviceSourceDAL = new DeviceSourceDALCaching(_configuration, isStandAlone);
 }
コード例 #5
0
 public static RemotePresentationClient CreatePresentationClient(ISourceDAL sourceDAL,
     IDeviceSourceDAL deviceSourceDAL, IPresentationNotifier callback, IClientConfiguration configuration)
 {
     return new RemotePresentationClient(callback, configuration, sourceDAL, deviceSourceDAL);
 }
コード例 #6
0
        //public static IPresentationWorker CreatePresentationWorker(bool isStandAlone, IPresentationNotifier callback)
        //{
        //    if (isStandAlone)
        //    {
        //        return new StandAlonePresentationWorker();
        //    }
        //    else
        //    {
        //        return (new DuplexClient<IPresentationWorker>(new InstanceContext(callback), 500)).Channel;
        //    }
        //}

        public static IPresentationClient CreateStandAlonePresentationWorker(ISourceDAL sourceDAL,
            IDeviceSourceDAL deviceSourceDAL, IClientConfiguration configuration,
            IPresentationNotifier notifier)
        {
            return new StandAlonePresentationWorker(sourceDAL, deviceSourceDAL, configuration, null /*notifier*/); // кажется в автономном режиме нотификация не нужна.
        }
コード例 #7
0
 public StandAlonePresentationWorker(ISourceDAL sourceDAL, IDeviceSourceDAL deviceSourceDAL,
     IConfiguration configuration, IPresentationNotifier notifier)
 {
     _configuration = configuration;
     _sourceDAL = sourceDAL;
     _deviceSourceDAL = deviceSourceDAL;
     _lockService = new LockingService(new TechnicalServices.Entity.UserIdentity(UserInfo.Empty, true, TimeSpan.MinValue, "localhost"), _configuration.EventLog);
     _presentationDAL = new StandAlonePresentationDAL(configuration);    //PresentationDAL
     _presentationDAL.Init(_sourceDAL, _deviceSourceDAL);
     _notifier = notifier;
     Init();
 }
コード例 #8
0
ファイル: ServerModule.cs プロジェクト: AlexSneg/VIRD-1.0
 public virtual ResourceDescriptor[] UploadResources(DisplayType displayType,
                                                     ResourceDescriptor[] resourceDescriptors,
                                                     ISourceDAL sourceDAL)
 {
     return resourceDescriptors;
 }