Example #1
0
 public LogViewModel(IBeursfuifData data)
     : base(data)
 {
     if (!IsInDesignMode)
     {
         MessengerInstance.Register<LogMessage>(this, LogMessageReceived);
         _beursfuifData.BeursfuifDataImported += BeursfuifData_BeursfuifDataImported;
         _beursfuifData.DataReset += BeursfuifData_DataReset;
     }
 }
Example #2
0
        public IntervalViewModel(IBeursfuifData beursfuifData)
            : base(beursfuifData)
        {
            if (IsInDesignMode)
            {
                #region DummyData
                Intervals = new Interval[]{
                    new Interval(){
                        Id = 1,
                        StartTime = new DateTime(1970,1,1,21,0,0),
                        EndTime = new DateTime(1970,1,1,21,15,0)
                    },
                    new Interval(){
                        Id = 2,
                        StartTime = new DateTime(1970,1,1,21,15,0),
                        EndTime = new DateTime(1970,1,1,21,30,0)
                    },
                    new Interval(){
                        Id = 3,
                        StartTime = new DateTime(1970,1,1,21,30,0),
                        EndTime = new DateTime(1970,1,1,21,45,0)
                    },
                    new Interval(){
                        Id = 4,
                        StartTime = new DateTime(1970,1,1,21,45,0),
                        EndTime = new DateTime(1970,1,1,22,00,0)
                    }
                };
                #endregion
            }
            else
            {
                PointInCode("IntervalViewModel: Ctor");

                _beursfuifData = beursfuifData;

                if (Intervals != null && Intervals.Any())
                {
                    BeginTime = Intervals[0].StartTime;
                    EndTime = Intervals[Intervals.Length - 1].EndTime;
                    ChosenInterval = IntervalChoices.FirstOrDefault(x => x.TotalMinutes == Intervals[0].Duration.TotalMinutes);
                    SendLogMessage("Intervals found in data folder", LogType.INTERVAL_VM);
                }

                InitCommands();
                CheckCanEdit();

                _beursfuifData.BeursfuifBusyChanged += BeursfuifData_BeursfuifBusyChanged;
                _beursfuifData.DataReset += BeursfuifData_DataReset;
                _beursfuifData.BeursfuifDataImported += BeursfuifData_BeursfuifDataImported;
            }
        }
Example #3
0
        public ClientsViewModel(IBeursfuifServer server, IBeursfuifData data)
            : base(data)
        {
            if (IsInDesignMode)
            {
                #region DummyData
                Clients = new ObservableCollection<Client>()
                {

                    new Client(){
                        Id = Guid.NewGuid(),
                        Ip = "192.168.1.101",
                        LastActivity = DateTime.Now,
                        Name = "Gilles",
                        OrderCount = 5
                    },
                    new Client(){
                        Id = Guid.NewGuid(),
                        Ip = "192.168.1.102",
                        LastActivity = DateTime.Now.Subtract(new TimeSpan(0,12,0)),
                        Name = "Jurgen",
                        OrderCount = 2
                    },
                    new Client(){
                        Id = Guid.NewGuid(),
                        Ip = "192.168.1.103",
                        LastActivity = DateTime.Now.Subtract(new TimeSpan(0,6,0)),
                        Name = "Florejan",
                        OrderCount = 14
                    },
                    new Client(){
                        Id = Guid.NewGuid(),
                        Ip = "192.168.1.104",
                        LastActivity = DateTime.Now.Subtract(new TimeSpan(0,2,0)),
                        Name = "Wouter",
                        OrderCount = 4
                    }

                };
                #endregion
            }
            else
            {
                PointInCode("ClientsViewModel: Ctor");
                _server = server;
                InitServer();
                InitCommands();
                InitMessages();
                _beursfuifData.BeursfuifBusyChanged += BeursfuifData_BeursfuifBusyChanged;
            }
        }
Example #4
0
        public DrinkViewModel(IBeursfuifData beursfuifData)
            : base(beursfuifData)
        {
            if (!IsInDesignMode)
            {
                PointInCode("DrinkViewModel: Ctor");
                _beursfuifData = beursfuifData;

                if (Drinks == null) Drinks = new ObservableCollection<Drink>();
                ThreadPool.QueueUserWorkItem(CleanUpImages);

                InitCommands();
                CheckCanEdit();

                _beursfuifData.BeursfuifBusyChanged += BeursfuifData_BeursfuifBusyChanged;
                _beursfuifData.DataReset += BeursfuifData_DataReset;
                _beursfuifData.BeursfuifDataImported += BeursfuifData_BeursfuifDataImported;
            }
        }
Example #5
0
        public OrdersViewModel(IBeursfuifServer server, IBeursfuifData beursfuifData)
            : base(beursfuifData)
        {
            if (!IsInDesignMode)
            {
                PointInCode("OrdersViewModel: Ctor");

                _server = server;
                InitServer();
                InitMessages();

                if (_beursfuifData.BeursfuifEverStarted)
                {
                    InitData();
                }

                _beursfuifData.DataReset += BeursfuifData_DataReset;
                _beursfuifData.BeursfuifDataImported += BeursfuifData_BeursfuifDataImported;
            }
        }
Example #6
0
 public BeursfuifServer(IBeursfuifData beursfuifData)
 {
     this._beursfuifData = beursfuifData;
 }
Example #7
0
        public SettingsViewModel(IBeursfuifData data, IBeursfuifServer server):base(data)
        {
            if (!IsInDesignMode)
            {
                PointInCode("SettingsViewModel: Ctor");
                _server = server;
                _beursfuifData.DataReset += BeursfuifData_DataReset;

                if (Directory.Exists(_beursfuifData.BackUpLocation))
                {
                    RaisePropertyChanged(BackupLocationPropertyName);
                }

                if (_beursfuifData.BeursfuifEverStarted)
                {
                    SendLogMessage("Beursfuif has already started", LogType.SETTINGS_VM);
                    if (BeursfuifBusy)
                    {
                        SendLogMessage("Resuming Beursfuif", LogType.SETTINGS_VM);
                        MainActionButtonContent = PAUSE_PARTY;
                        ResumeParty();
                    }
                    else
                    {
                        SendLogMessage("Beursfuif paused", LogType.SETTINGS_VM);
                        MainActionButtonContent = RESUME_PARTY;
                    }
                }
                else
                {
                    MainActionButtonContent = PARTY_NEVER_STARTED;
                    SendLogMessage("Beursfuif has never started", LogType.SETTINGS_VM);
                }
      
                InitCommands();
                InitServer();
                InitMessages();

            }
        }
 public BeursfuifViewModelBase(IBeursfuifData beursfuifData)
 {
     _beursfuifData = beursfuifData;
     InitHideShowMessage();
 }