Esempio n. 1
0
        public StatusViewModel()
        {
            this.cashpoints = new ObservableCollection<Cashpoint>();
            cashpointsLock = new object();
            BindingOperations.EnableCollectionSynchronization(cashpoints, cashpointsLock);

            var assembly = Assembly.GetAssembly(typeof(StatusViewModel));
            var resourceName = "FHoner.Kasse.LiveView.Resources/horn-sound.wav";
            this.player = new SoundPlayer(assembly.GetManifestResourceStream(resourceName));
            this.printerSoundTimer = new Timer(
                    new TimerCallback((par) =>
                    {
                        PlayHornSound();
                    }),
                    null,
                    Timeout.Infinite,
                    SOUND_INTERVAL_SECONDS * 1000
                );

            this.server = new Server();
            this.server.CashpointConnected += server_CashpointConnected;
            this.server.CashpointDisconnected += server_CashpointDisconnected;
            this.server.CashpointMsgReceived += server_CashpointMsgReceived;
            this.server.Start();
        }
Esempio n. 2
0
        public MainWindowViewModel()
        {
            this.cashpoints = new ObservableCollection<Cashpoint>();
            cashpointsLock = new object();
            BindingOperations.EnableCollectionSynchronization(cashpoints, cashpointsLock);

            this.player = new SoundPlayer(Properties.Resources.horn_sound);
            this.printerSoundTimer = new Timer(
                    new TimerCallback((par) =>
                    {
                        PlayHornSound();
                    }),
                    null,
                    Timeout.Infinite,
                    SOUND_INTERVAL_SECONDS * 1000
                );

            this.server = new Server();
            this.server.CashpointConnected += server_CashpointConnected;
            this.server.CashpointDisconnected += server_CashpointDisconnected;
            this.server.CashpointMsgReceived += server_CashpointMsgReceived;
            this.server.Start();
        }