Esempio n. 1
0
        protected Game(
            ILogger logger,
            IServiceProvider serviceProvider,
            GameSettings gameSettings)
        {
            Logger = logger.ForContext <Game>();

            ServiceProvider     = serviceProvider;
            Window              = new GameWindow(GameWindowSettings.Default, gameSettings._nativeWindowSettings);
            Window.Load        += Load;
            Window.Unload      += Unload;
            Window.UpdateFrame += Update;
            Window.RenderFrame += Render;

            var monitorHandle = Monitors.GetMonitorFromWindow(Window);

            if (Monitors.TryGetMonitorInfo(monitorHandle, out var monitorInfo))
            {
                var windowSize     = monitorInfo.ClientArea.Size * 90 / 100;
                var windowLocation = monitorInfo.ClientArea.HalfSize - windowSize / 2;

                Window.Location = windowLocation;
                Window.Size     = windowSize;
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoRoundRobin()
        public virtual void TwoRoundRobin()
        {
            ManagedCluster cluster = StartCluster(4, 2, HaSettings.TxPushStrategy.RoundRobin);

            HighlyAvailableGraphDatabase master = cluster.Master;
            Monitors      monitors            = master.DependencyResolver.resolveDependency(typeof(Monitors));
            AtomicInteger totalMissedReplicas = new AtomicInteger();

            monitors.AddMonitorListener((MasterTransactionCommitProcess.Monitor)totalMissedReplicas.addAndGet);
            long txId  = GetLastTx(master);
            int  count = 15;

            for (int i = 0; i < count; i++)
            {
                CreateTransactionOnMaster(cluster);
            }

            long min = -1;
            long max = -1;

            foreach (GraphDatabaseAPI db in cluster.AllMembers)
            {
                long tx = GetLastTx(db);
                min = min == -1 ? tx : min(min, tx);
                max = max == -1 ? tx : max(max, tx);
            }

            assertEquals(txId + count, max);
            assertTrue("There should be members with transactions in the cluster", min != -1 && max != -1);

            int minLaggingBehindThreshold = 1 + totalMissedReplicas.get();

            assertThat("There should at most be a txId gap of 1 among the cluster members since the transaction pushing " + "goes in a round robin fashion. min:" + min + ", max:" + max, ( int )(max - min), lessThanOrEqualTo(minLaggingBehindThreshold));
        }
Esempio n. 3
0
        public static void UpdateWindowState(this ViewConfig config, Window main)
        {
            if (config.WindowStates == null)
            {
                return;
            }

            var monitor = Monitors.FullScreen();

            if (config.WindowStates.Top < monitor.Height && config.WindowStates.Left < monitor.Width)
            {
                main.WindowState = (System.Windows.WindowState)Enum.Parse(typeof(WindowState), config.WindowStates.WindowState.ToString(), true);
                if (config.WindowStates.CanShow)
                {
                    main.Top    = config.WindowStates.Top;
                    main.Left   = config.WindowStates.Left;
                    main.Width  = config.WindowStates.Width;
                    main.Height = config.WindowStates.Height;
                }
            }
            void OnDisplaySettingsChanged(object sender, EventArgs args) => UpdateWindowState(config, main);

            Microsoft.Win32.SystemEvents.DisplaySettingsChanged -= OnDisplaySettingsChanged;
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged += OnDisplaySettingsChanged;
        }
Esempio n. 4
0
        public static ClusterInstance NewClusterInstance(InstanceId id, URI uri, Monitors monitors, ClusterConfiguration configuration, int maxSurvivableFailedMembers, LogProvider logging)
        {
            MultiPaxosServerFactory factory = new MultiPaxosServerFactory(configuration, logging, monitors.NewMonitor(typeof(StateMachines.Monitor)));

            ClusterInstanceInput  input  = new ClusterInstanceInput();
            ClusterInstanceOutput output = new ClusterInstanceOutput(uri);

            ObjectStreamFactory objStreamFactory = new ObjectStreamFactory();

            ProverTimeouts timeouts = new ProverTimeouts(uri);

            InMemoryAcceptorInstanceStore acceptorInstances = new InMemoryAcceptorInstanceStore();

            Config config = mock(typeof(Config));

            when(config.Get(ClusterSettings.max_acceptors)).thenReturn(maxSurvivableFailedMembers);

            DelayedDirectExecutor executor = new DelayedDirectExecutor(logging);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext context = new org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext(id, org.neo4j.helpers.collection.Iterables.iterable(new org.neo4j.cluster.protocol.election.ElectionRole(org.neo4j.cluster.protocol.cluster.ClusterConfiguration.COORDINATOR)), new org.neo4j.cluster.protocol.cluster.ClusterConfiguration(configuration.getName(), logging, configuration.getMemberURIs()), executor, logging, objStreamFactory, objStreamFactory, acceptorInstances, timeouts, new org.neo4j.kernel.ha.cluster.DefaultElectionCredentialsProvider(id, new StateVerifierLastTxIdGetter(), new MemberInfoProvider()), config);
            MultiPaxosContext context = new MultiPaxosContext(id, Iterables.iterable(new ElectionRole(ClusterConfiguration.COORDINATOR)), new ClusterConfiguration(configuration.Name, logging, configuration.MemberURIs), executor, logging, objStreamFactory, objStreamFactory, acceptorInstances, timeouts, new DefaultElectionCredentialsProvider(id, new StateVerifierLastTxIdGetter(), new MemberInfoProvider()), config);

            context.ClusterContext.BoundAt = uri;

            SnapshotContext snapshotContext = new SnapshotContext(context.ClusterContext, context.LearnerContext);

            DelayedDirectExecutor taskExecutor = new DelayedDirectExecutor(logging);
            ProtocolServer        ps           = factory.NewProtocolServer(id, input, output, DirectExecutor, taskExecutor, timeouts, context, snapshotContext);

            return(new ClusterInstance(DirectExecutor, logging, factory, ps, context, acceptorInstances, timeouts, input, output, uri));
        }
Esempio n. 5
0
        private void ThrowsWhenRunMessageFails(System.Action <ThrowingSessionMonitor> monitorSetup)
        {
            ThrowingSessionMonitor sessionMonitor = new ThrowingSessionMonitor();
            Monitors monitors = NewMonitorsSpy(sessionMonitor);

            _db     = StartTestDb(monitors);
            _driver = CreateDriver(getBoltPort(_db));

            // open a session and start a transaction, this will force driver to obtain
            // a network connection and bind it to the transaction
            Session     session = _driver.session();
            Transaction tx      = session.beginTransaction();

            // at this point driver holds a valid initialize connection
            // setup monitor to throw before running the query to make processing of the RUN message fail
            monitorSetup(sessionMonitor);
            tx.run("CREATE ()");
            try
            {
                tx.close();
                session.close();
                fail("Exception expected");
            }
            catch (Exception e)
            {
                assertThat(e, instanceOf(typeof(ServiceUnavailableException)));
            }
        }
Esempio n. 6
0
        private void ThrowsWhenInitMessageFails(System.Action <ThrowingSessionMonitor> monitorSetup, bool shouldBeAbleToBeginTransaction)
        {
            ThrowingSessionMonitor sessionMonitor = new ThrowingSessionMonitor();

            monitorSetup(sessionMonitor);
            Monitors monitors = NewMonitorsSpy(sessionMonitor);

            _db = StartTestDb(monitors);

            try
            {
                _driver = GraphDatabase.driver("bolt://localhost:" + getBoltPort(_db), Config.build().withoutEncryption().toConfig());
                if (shouldBeAbleToBeginTransaction)
                {
                    using (Session session = _driver.session(), Transaction tx = session.beginTransaction())
                    {
                        tx.run("CREATE ()").consume();
                    }
                }
                else
                {
                    fail("Exception expected");
                }
            }
            catch (Exception e)
            {
                assertThat(e, instanceOf(typeof(ServiceUnavailableException)));
            }
        }
Esempio n. 7
0
        protected Game(
            ILogger logger,
            GameSettings gameSettings,
            IShaderFactory shaderFactory)
        {
            _shaderFactory = shaderFactory;
            Logger         = logger.ForContext <Game>();

            var gameWindowSettings = GameWindowSettings.Default;

            Window              = new GameWindow(gameWindowSettings, gameSettings._nativeWindowSettings);
            Window.Load        += Load;
            Window.Unload      += Unload;
            Window.UpdateFrame += Update;
            Window.RenderFrame += Render;
            Window.VSync        = VSyncMode.Off;

            var monitorHandle = Window.FindMonitor();

            if (Monitors.TryGetMonitorInfo(monitorHandle, out var monitorInfo))
            {
                var windowSize     = monitorInfo.ClientArea.Size * 90 / 100;
                var windowLocation = monitorInfo.ClientArea.HalfSize - windowSize / 2;

                Window.Location = windowLocation;
                Window.Size     = windowSize;
            }

            Camera = new Camera(CameraMode.Orthogonal, new Vector3(0, 0, 256), Window.Size.X / (float)Window.Size.Y);
        }
Esempio n. 8
0
        public virtual NeoStoreDataSource GetDataSource(DatabaseLayout databaseLayout, FileSystemAbstraction fs, PageCache pageCache, DependencyResolver otherCustomOverriddenDependencies)
        {
            ShutdownAnyRunning();

            StatementLocksFactory locksFactory   = mock(typeof(StatementLocksFactory));
            StatementLocks        statementLocks = mock(typeof(StatementLocks));

            Org.Neo4j.Kernel.impl.locking.Locks_Client locks = mock(typeof(Org.Neo4j.Kernel.impl.locking.Locks_Client));
            when(statementLocks.Optimistic()).thenReturn(locks);
            when(statementLocks.Pessimistic()).thenReturn(locks);
            when(locksFactory.NewInstance()).thenReturn(statementLocks);

            JobScheduler jobScheduler = mock(typeof(JobScheduler), RETURNS_MOCKS);
            Monitors     monitors     = new Monitors();

            Dependencies mutableDependencies = new Dependencies(otherCustomOverriddenDependencies);

            // Satisfy non-satisfied dependencies
            Config config = Dependency(mutableDependencies, typeof(Config), deps => Config.defaults());

            config.augment(default_schema_provider, EMPTY.ProviderDescriptor.name());
            LogService                  logService              = Dependency(mutableDependencies, typeof(LogService), deps => new SimpleLogService(NullLogProvider.Instance));
            IdGeneratorFactory          idGeneratorFactory      = Dependency(mutableDependencies, typeof(IdGeneratorFactory), deps => new DefaultIdGeneratorFactory(fs));
            IdTypeConfigurationProvider idConfigurationProvider = Dependency(mutableDependencies, typeof(IdTypeConfigurationProvider), deps => new CommunityIdTypeConfigurationProvider());
            DatabaseHealth              databaseHealth          = Dependency(mutableDependencies, typeof(DatabaseHealth), deps => new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), NullLog.Instance));
            SystemNanoClock             clock = Dependency(mutableDependencies, typeof(SystemNanoClock), deps => Clocks.nanoClock());
            TransactionMonitor          transactionMonitor        = Dependency(mutableDependencies, typeof(TransactionMonitor), deps => new DatabaseTransactionStats());
            DatabaseAvailabilityGuard   databaseAvailabilityGuard = Dependency(mutableDependencies, typeof(DatabaseAvailabilityGuard), deps => new DatabaseAvailabilityGuard(DEFAULT_DATABASE_NAME, deps.resolveDependency(typeof(SystemNanoClock)), NullLog.Instance));

            Dependency(mutableDependencies, typeof(DiagnosticsManager), deps => new DiagnosticsManager(NullLog.Instance));
            Dependency(mutableDependencies, typeof(IndexProvider), deps => EMPTY);

            _dataSource = new NeoStoreDataSource(new TestDatabaseCreationContext(DEFAULT_DATABASE_NAME, databaseLayout, config, idGeneratorFactory, logService, mock(typeof(JobScheduler), RETURNS_MOCKS), mock(typeof(TokenNameLookup)), mutableDependencies, mockedTokenHolders(), locksFactory, mock(typeof(SchemaWriteGuard)), mock(typeof(TransactionEventHandlers)), IndexingService.NO_MONITOR, fs, transactionMonitor, databaseHealth, mock(typeof(LogFileCreationMonitor)), TransactionHeaderInformationFactory.DEFAULT, new CommunityCommitProcessFactory(), mock(typeof(InternalAutoIndexing)), mock(typeof(IndexConfigStore)), mock(typeof(ExplicitIndexProvider)), pageCache, new StandardConstraintSemantics(), monitors, new Tracers("null", NullLog.Instance, monitors, jobScheduler, clock), mock(typeof(Procedures)), Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited, databaseAvailabilityGuard, clock, new CanWrite(), new StoreCopyCheckPointMutex(), RecoveryCleanupWorkCollector.immediate(), new BufferedIdController(new BufferingIdGeneratorFactory(idGeneratorFactory, Org.Neo4j.Kernel.impl.store.id.IdReuseEligibility_Fields.Always, idConfigurationProvider), jobScheduler), DatabaseInfo.COMMUNITY, new TransactionVersionContextSupplier(), ON_HEAP, Collections.emptyList(), file => EMPTY_WATCHER, new GraphDatabaseFacade(), Iterables.empty()));
            return(_dataSource);
        }
Esempio n. 9
0
        public static Event GetLastQueueEvent(IEventRepository eventRepository, Monitors monitor, Pmta pmta, string queue)
        {
            var events = eventRepository.GetAll().Where(e => e.Monitor == monitor && !e.ResetEventId.HasValue && e.EventName != EventNames.ResetTime 
                                                             && e.EventActions.Any(ed => ed.PmtaId == pmta.PmtaId && ed.PmtaQueue.ToLower() == queue.ToLower()));

            return events.Any() ? events.OrderByDescending(e=>e.DateCreated).First() : null;
        }
Esempio n. 10
0
        private void Add(Rect bounds, Rect workArea, bool primary)
        {
            var monitor = new Monitor(bounds, workArea, primary);

            bool inserted     = false;
            var  workAreaRect = workArea;

            for (int i = 0; i < Monitors.Count && !inserted; i++)
            {
                var rect = Monitors[i].Device.WorkAreaRect;
                if (workAreaRect.Left < rect.Left && (workAreaRect.Top <= rect.Top || workAreaRect.Top == 0))
                {
                    Monitors.Insert(i, monitor);
                    inserted = true;
                }
                else if (workAreaRect.Left == rect.Left && workAreaRect.Top < rect.Top)
                {
                    Monitors.Insert(i, monitor);
                    inserted = true;
                }
            }

            if (!inserted)
            {
                Monitors.Add(monitor);
            }
        }
Esempio n. 11
0
 public StoreCopyClient(CatchUpClient catchUpClient, Monitors monitors, LogProvider logProvider, TimeoutStrategy backOffStrategy)
 {
     this._catchUpClient = catchUpClient;
     this._monitors      = monitors;
     _log = logProvider.getLog(this.GetType());
     this._backOffStrategy = backOffStrategy;
 }
Esempio n. 12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ClusterNetworkIT(int nrOfServers, ClusterTestScript script) throws java.net.URISyntaxException
        public ClusterNetworkIT(int nrOfServers, ClusterTestScript script)
        {
            this._script = script;

            @out.Clear();
            @in.Clear();

            for (int i = 0; i < nrOfServers; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.net.URI uri = new java.net.URI("neo4j://localhost:" + org.neo4j.ports.allocation.PortAuthority.allocatePort());
                URI uri = new URI("neo4j://localhost:" + PortAuthority.allocatePort());

                Monitors monitors = new Monitors();
                NetworkedServerFactory factory = new NetworkedServerFactory(_life, new MultiPaxosServerFactory(new ClusterConfiguration("default", NullLogProvider.Instance), NullLogProvider.Instance, monitors.NewMonitor(typeof(StateMachines.Monitor))), new FixedTimeoutStrategy(1000), NullLogProvider.Instance, new ObjectStreamFactory(), new ObjectStreamFactory(), monitors.NewMonitor(typeof(NetworkReceiver.Monitor)), monitors.NewMonitor(typeof(NetworkSender.Monitor)), monitors.NewMonitor(typeof(NamedThreadFactory.Monitor)));

                ServerIdElectionCredentialsProvider electionCredentialsProvider = new ServerIdElectionCredentialsProvider();
                ProtocolServer server = factory.NewNetworkedServer(Config.defaults(MapUtil.stringMap(ClusterSettings.cluster_server.name(), uri.Host + ":" + uri.Port, ClusterSettings.server_id.name(), "" + i)), new InMemoryAcceptorInstanceStore(), electionCredentialsProvider);
                server.AddBindingListener(electionCredentialsProvider);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Cluster cluster2 = server.newClient(Cluster.class);
                Cluster cluster2 = server.NewClient(typeof(Cluster));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<ClusterConfiguration> config2 = clusterStateListener(uri, cluster2);
                AtomicReference <ClusterConfiguration> config2 = ClusterStateListener(uri, cluster2);

                _servers.Add(cluster2);
                @out.Add(cluster2);
                _configurations.Add(config2);
            }

            _life.start();
        }
Esempio n. 13
0
        public UserBrowserActivity()
        {
            IEnumerable <string> missingFolders = UserKnownFolders.Where(f => !Directory.Exists(f));

            if (missingFolders.Count() > 0)
            {
                Warn("The following folders do not exist and will not be monitored: {0}", missingFolders);
                UserKnownFolders.RemoveAll(f => !Directory.Exists(f));
            }
            if (UserKnownFolders.Count == 0)
            {
                Error("No directories to monitor.");
                Status = ApiStatus.FileNotFound;
                return;
            }

            Monitors.Add(new DirectoryChangesMonitor(UserKnownFolders.ToArray(),
                                                     BasicImageWildcardExtensions.ToArray(), this));

            List <IMonitor> browserWindowMonitors = new List <IMonitor>()
            {
                new AppWindowMonitor(this, "chrome"),
                new AppWindowMonitor(this, "firefox"),
                new AppWindowMonitor(this, "MicrosoftEdgeCP"),
            };

            Monitors.AddRange(browserWindowMonitors);

            Pipeline = new ImagePipeline(this);
            Status   = Pipeline.Status;
        }
Esempio n. 14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _logProvider   = new DuplicatingLogProvider(_assertableLogProvider, FormattedLogProvider.withDefaultLogLevel(Level.DEBUG).toOutputStream(System.out));
            _serverHandler = new TestCatchupServerHandler(_logProvider, TestDirectory, _fsa);
            _serverHandler.addFile(_fileA);
            _serverHandler.addFile(_fileB);
            _serverHandler.addIndexFile(_indexFileA);
            WriteContents(_fsa, Relative(_fileA.Filename), _fileA.Content);
            WriteContents(_fsa, Relative(_fileB.Filename), _fileB.Content);
            WriteContents(_fsa, Relative(_indexFileA.Filename), _indexFileA.Content);

            ListenSocketAddress listenAddress = new ListenSocketAddress("localhost", PortAuthority.allocatePort());

            _catchupServer = (new CatchupServerBuilder(_serverHandler)).listenAddress(listenAddress).build();
            _catchupServer.start();

            CatchUpClient catchUpClient = (new CatchupClientBuilder()).build();

            catchUpClient.Start();

            ConstantTimeTimeoutStrategy storeCopyBackoffStrategy = new ConstantTimeTimeoutStrategy(1, TimeUnit.MILLISECONDS);

            Monitors monitors = new Monitors();

            _subject = new StoreCopyClient(catchUpClient, monitors, _logProvider, storeCopyBackoffStrategy);
        }
Esempio n. 15
0
    /// <summary>
    /// XML monitor configuration file load (multimonitor setups).
    /// </summary>
    /// <remarks>
    /// Location: %USERPROFILE%\\Saved Games\\rePaper\\monitor.xml
    /// </remarks>
    public void LoadMonitor()
    {
        if (File.Exists(System.Environment.ExpandEnvironmentVariables("%USERPROFILE%\\Saved Games\\rePaper\\") + "monitor.xml"))
        {
            try
            {
                XmlSerializer ser  = new XmlSerializer(typeof(Monitors));
                FileStream    file = File.Open(System.Environment.ExpandEnvironmentVariables("%USERPROFILE%\\Saved Games\\rePaper\\") + "monitor.xml", FileMode.Open);
                //loadMonitorData = (Monitors)ser.Deserialize(file);
                monitor = (Monitors)ser.Deserialize(file);
                file.Close();

                /*
                 * monitor.xres = loadMonitorData.xres;
                 * monitor.yres = loadMonitorData.yres;
                 * monitor.xoff = loadMonitorData.xoff;
                 * monitor.yoff = loadMonitorData.yoff;
                 * monitor.display_name = loadMonitorData.display_name;
                 */
            }
            catch (Exception ex)
            {
                Debug.Log("something went wrong reading file: " + ex.Message);
            }
        }
        else
        {
            monitor.xres = Screen.currentResolution.width;
            monitor.yres = Screen.currentResolution.height;
            Save_Monitor();
        }
    }
Esempio n. 16
0
        public HeliosProfile(bool autoAddInterfaces)
        {
            Monitors.CollectionChanged   += Monitors_CollectionChanged;
            Interfaces.CollectionChanged += Interfaces_CollectionChanged;

            int i = 1;

            foreach (Monitor display in ConfigManager.DisplayManager.Displays)
            {
                Monitor monitor = new Monitor(display)
                {
                    Name = "Monitor " + i++
                };
                Monitors.Add(monitor);
            }

            if (autoAddInterfaces)
            {
                foreach (HeliosInterfaceDescriptor descriptor in ConfigManager.ModuleManager.InterfaceDescriptors)
                {
                    foreach (HeliosInterface newInterface in descriptor.GetAutoAddInstances(this))
                    {
                        Interfaces.Add(newInterface);
                    }
                }
            }

            LoadTime = DateTime.MinValue;
        }
Esempio n. 17
0
        /// <summary>
        /// This method deregister a patient from monitor list
        /// </summary>
        /// <param name="monitor"></param>
        public void DeregisterMonitor(Monitor monitor)
        {
            var patient = Patients.SingleOrDefault(p => p.Value.Id == monitor.PatientId).Value;

            Monitors?.Remove(Monitors.SingleOrDefault(m => m.PatientId == monitor.PatientId));
            patient.ChangePatientMonitorState();
            HighCholFlag();
        }
Esempio n. 18
0
            internal SolverContext Monitor(Func <Solver, SearchMonitor> monitor)
            {
                var m = monitor(Solver);

                Clr.Add(m);
                Monitors.Add(m);
                return(this);
            }
Esempio n. 19
0
        private ReadReplica AddReadReplica(int memberId, string recordFormat, Monitors monitors)
        {
            IList <AdvertisedSocketAddress> initialHosts = ExtractInitialHosts(_coreMembers);
            ReadReplica member = CreateReadReplica(memberId, initialHosts, _readReplicaParams, _instanceReadReplicaParams, recordFormat, monitors);

            _readReplicas[memberId] = member;
            return(member);
        }
 public BuildStatusConfig()
 {
     Settings    = new Settings();
     Schedules   = new Schedules();
     Controllers = new Controllers();
     Monitors    = new Monitors();
     Visualisers = new Visualisers();
     Transitions = new Transitions();
 }
Esempio n. 21
0
 public static IQueryable<Event> GetEventsToReset(IEventRepository eventRepository, Monitors monitor)
 {
     return eventRepository.GetAll().Where(e => !e.ResetEventId.HasValue && e.Monitor == monitor && e.EventName != Event.EventNames.ResetTime);
 }
Esempio n. 22
0
        internal void ProcessStackingUpdate(Monitors.StackingUpdate stackingUpdate)
        {
            if (stackingUpdate.Event == Monitors.StackingEvent.PhyicalStacking)
              {
            SendMessage(new StackingMessage()
            {
              MessageType = StackingMessageType.StackingRequest,
              SourceDeviceID = ID,
              TargetDeviceID = stackingUpdate.DeviceOnTopID
            });
              }
              else if (stackingUpdate.Event == Monitors.StackingEvent.PhysicalSeparation)
              {
            SendMessage(new StackingMessage()
            {
              MessageType = StackingMessageType.EndNotification,
              SourceDeviceID = ID,
              TargetDeviceID = stackingUpdate.DeviceOnTopID
            });

            State = StackingState.NotStacked;
            DeviceBelow = -1;
            DeviceOnTop = -1;

            //Notify the app that it is no longer stacked
            if (StackingChanged != null)
              StackingChanged(this, new StackingEventArgs() { State = StackingState.NotStacked, DeviceBelow = DeviceBelow, DeviceOnTop = DeviceOnTop });
              }
        }