示例#1
0
        public AboutViewModel()
        {
            Title = "Welcome";

            UnlockCommand = new Command(async() => {
                var authsomeService = new AuthsomeService();
                await authsomeService.PostAsync <object>("http://[yourserver]:84/api/Message", new IOTDevice.Models.Notification()
                {
                    //DeviceId = 10,
                    Message    = "Open the door!",
                    ShouldOpen = true
                });
            });



            LockCommand = new Command(async() => {
                var authsomeService = new AuthsomeService();
                await authsomeService.PostAsync <object>("http://[yourserver]:84/api/Message", new IOTDevice.Models.Notification()
                {
                    //DeviceId = 10,
                    Message    = "Lock the door!",
                    ShouldOpen = false
                });
            });
        }
示例#2
0
        static void Main(string[] args)
        {
            var authsome = new AuthsomeService();
            var testApp  = new AmplitudeService(authsome);

            Task.Run(async() =>
            {
                var user_properties = new Dictionary <string, string>();
                user_properties.Add("LoginButton", "Clicked");
                user_properties.Add("CreateUserButton", "Clicked");

                await testApp.PostEvent(apiKey, new Event()
                {
                    user_id         = "0",
                    event_type      = "LoginView",
                    user_properties = user_properties,
                    time            = DateTime.Now.Ticks
                });

                Console.WriteLine("Post Sent!");
                Console.ReadLine();
            });

            Console.ReadLine();
            Console.WriteLine("Hello World!");
        }