Beispiel #1
0
        public async Task Start()
        {
            deviceInfo      = new DeviceInfo();
            authsomeService = new AuthsomeService();
            GPIOService     = new GPIOService();

            if (!deviceInfo.DoesFileExists())
            {
                var newDevice = await authsomeService.PostAsync <Device>(baseUrl + "/api/Device", new Device()
                {
                    Name = "MyIOTDevice"
                });

                if (newDevice.httpStatusCode == System.Net.HttpStatusCode.OK)
                {
                    device = newDevice.Content;

                    // stores the device file
                    await deviceInfo.WriteDeviceFile(device);

                    // informs the user the device has been registered
                    Console.WriteLine("device registered: " + device.Id);
                }
            }
            else
            {
                // the device has already been registered, read the information
                device = await deviceInfo.ReadDeviceFile();

                Console.WriteLine("device file found: " + device.Id);
            }

            hubConnector            = new HubConnector();
            hubConnector.OnReceive += HubConnector_OnReceive;
            hubConnector.Connect(baseUrl, device);
        }
 public ApolloService(IAuthsomeService authsomeService)
 {
     this.authsomeService = authsomeService;
 }
 public ClickUpService(IAuthsomeService authsomeService, IOptions <ClickUpSettings> appSettings)
 {
     this.authsomeService = authsomeService;
     this.appSettings     = appSettings.Value;
 }
 public MainWindow()
 {
     authsomeService = new AuthsomeService();
     InitializeComponent();
 }
Beispiel #5
0
 public AmplitudeService(IAuthsomeService authsomeService)
 {
     this.authsomeService = authsomeService;
     authsomeService.Provider.APIBaseUrl = "https://api.amplitude.com/";
 }