public TableManagerViewModel(string databasepath)
 {
     logger.Info($"Starting Table Manager: {databasepath}");
     this.databasepath = databasepath;
     Data = new PinballData(this.databasepath);
     InitalizeDummyWindows();
 }
        public TableManagerView(PinballData data)
        {
            InitializeComponent();

            viewModel        = new PinballFrontEnd.ViewModel.TableManagerViewModel(data);
            this.DataContext = viewModel;
        }
        private async void StartEverything()
        {
            Data = new PinballData();
            await Task.Run(() => Data.LoadDatabase(databasepath));

            //InitializePlayers();
            //LoadDatabase();
            await Task.Run(() => InitializeKeyboardHook());

            await Task.Run(() => InitalizeThumbnails());

            await Task.Run(() => InitializeBGMusic());

            RandomTable();
            InitalizeWindows();
        }
        //Default Constructor
        public PinballFrontEndViewModel()
        {
            logger.Info($"Starting Pinball Front End: {Model.ProgramPath.Value}");

            Data = new PinballData();
            Data.LoadDatabase(databasepath);

            //InitializePlayers();
            //LoadDatabase();

            InitializeKeyboardHook();
            InitalizeThumbnails1();
            InitializeBGMusic();
            RandomTable();
            InitalizeWindows();


            //StartEverything();
        }
예제 #5
0
        private async Task Log_Event(string DataValue, string Name, string Sensor, string DataType, string UnitOfMeasure)
        {
            //Debug
            DateTime localDate = DateTime.Now;
            System.Diagnostics.Debug.WriteLine("Event: " + Name + "-" + Sensor + "-" + DataValue + "-" + localDate.ToString());

            string AzureMode = "Derp";
            string internetConnected = "Derp";

            //to Azure
            if (AzureMode == "Transmit")
                if (internetConnected == "True")
                {
                    {

                        //Init httpClinet:
                        //var httpClient = new HttpClient();

                        System.Diagnostics.Debug.WriteLine("Starting Azure Transmit");


                        PinballData PinballGameInstance = new PinballData();
                        PinballGameInstance.Name = Name;
                        PinballGameInstance.SensorType = Sensor;
                        PinballGameInstance.TimeStamp = DateTime.Now.ToString();
                        PinballGameInstance.PlayerName = currentPlayer;
                        PinballGameInstance.PlayerScore = score;
                        PinballGameInstance.PlayerGameStartTime = GameStartDateTime.ToString();
                        PinballGameInstance.PlayerGameEndTime = GameStopDateTime.ToString();
                        PinballGameInstance.GameID = Guid.NewGuid().ToString();


                        string jsoncontent = JsonConvert.SerializeObject(PinballGameInstance);


                        DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(DeviceConnectionString);

                        string dataBuffer;
                        dataBuffer = jsoncontent;

                        System.Diagnostics.Debug.WriteLine(jsoncontent);


                        Message eventMessage = new Message(Encoding.UTF8.GetBytes(dataBuffer));
                        await deviceClient.SendEventAsync(eventMessage);


                        System.Diagnostics.Debug.WriteLine("Azure Transmit Done");



                    }
                }


        }
 public TableManagerViewModel(PinballData data)
 {
     logger.Info("Starting Table Manager");
     this.Data = data;
     InitalizeDummyWindows();
 }