예제 #1
0
        public LogInPage()
        {
            InitializeComponent();


            LogInWebView.IsVisible = false;
            Indicator.IsVisible    = false;

            LogInWebView.Navigated  += LogInWebViewOnNavigated;
            LogInWebView.Navigating += LogInWebViewOnNavigating;
            Title = L10n.Localize("LoginTitle");


            FbButton.Image = Device.OnPlatform(iOS: ImageSource.FromFile("Resources/facebook-logo.png"),
                                               Android: ImageSource.FromFile("Resources/drawable/facebook-logo.png")
                                               , WinPhone: ImageSource.FromFile("Assets/facebook-logo.png")) as FileImageSource;


            GoogleButton.Image = Device.OnPlatform(iOS: ImageSource.FromFile("Resources/google.png"),
                                                   Android: ImageSource.FromFile("Resources/drawable/google.png")
                                                   , WinPhone: ImageSource.FromFile("Assets/google.png")) as FileImageSource;
            MeazonButton.Image = Device.OnPlatform(iOS: ImageSource.FromFile("Resources/User.png"),
                                                   Android: ImageSource.FromFile("Resources/drawable/User.png")
                                                   , WinPhone: ImageSource.FromFile("Assets/User.png")) as FileImageSource;
        }
예제 #2
0
        private async void TapGestureRecognizer_OnTapped(object sender, EventArgs e)
        {
            option = await DisplayActionSheet(L10n.Localize("StateLabel"), L10n.Localize("CancelLabel"), "",
                                              L10n.Localize("State1"), L10n.Localize("State2"), L10n.Localize("State3"));

            if (!string.Equals(option, L10n.Localize("CancelLabel")))
            {
                if (string.Equals(option, L10n.Localize("State2")))
                {
                    await st.PostStateAction(st.TranslateStateAction(StateLabel.Text), "ask");
                }
                else if (string.Equals(option, L10n.Localize("State1")))
                {
                    await st.PostStateAction(st.TranslateStateAction(StateLabel.Text), "override");
                }

                else if (string.Equals(option, L10n.Localize("State3")))
                {
                    await st.PostStateAction(st.TranslateStateAction(StateLabel.Text), "nothing");
                }

                StateGrid.IsVisible = false;
                StateLabel.Text     = option;
                StateGrid.IsVisible = true;
            }
        }
예제 #3
0
        public string IndexToDay(int i)
        {
            switch (i)
            {
            case 0:
                return(L10n.Localize("SatLabel"));

            case 1:
                return(L10n.Localize("SunLabel"));

            case 2:
                return(L10n.Localize("MonLabel"));

            case 3:
                return(L10n.Localize("TueLabel"));

            case 4:
                return(L10n.Localize("WedLabel"));

            case 5:
                return(L10n.Localize("ThuLabel"));

            default:
                return(L10n.Localize("FriLabel"));
            }
        }
예제 #4
0
        private async void Button_SaveOnClicked(object sender, EventArgs e)
        {
            string tmp = MyEntry.Text;

            if (tmp != null)
            {
                Match match = regex.Match(tmp);
                if (match.Success)
                {
                    var r = new CoAdminResources();



                    var admin = new CoAdmin
                    {
                        Email = tmp
                    };
                    await r.PostAdminAsync(admin);



                    await Navigation.PopAsync();
                }
                else
                {
                    await DisplayAlert(L10n.Localize("AlertLabel"), L10n.Localize("ValidationAlert"), L10n.Localize("OkAction"));
                }
            }
            else
            {
                await DisplayAlert(L10n.Localize("AlertLabel"), L10n.Localize("NullAlert"), L10n.Localize("OkAction"));
            }
        }
예제 #5
0
        public async Task <string> GetStateAction()
        {
            var client = new HttpClient();

            client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", App.USERTOKEN);

            var httpUrl  = "https://izy.meazon.com/api/energylog/UserSettings?key=Override.Scheduler";
            var jsonData = await client.GetStringAsync(httpUrl);

            var act = JsonConvert.DeserializeObject <string>(jsonData);


            string action;

            if (act == null)
            {
                return("");
            }

            if (string.Equals(act, "ask"))
            {
                action = L10n.Localize("State2");
            }
            else if (string.Equals(act, "nothing"))
            {
                action = L10n.Localize("State3");
            }
            else
            {
                action = L10n.Localize("State1");
            }

            return(action);
        }
예제 #6
0
        public ObservableCollection <MainMenuItems> GetNames()
        {
            ObservableCollection <MainMenuItems> Namelist = new ObservableCollection <MainMenuItems>
            {
                new MainMenuItems
                {
                    Name  = L10n.Localize("DevicesTitle"), Color = Color.Purple,
                    Image = "https://izy.meazon.com/app/content/img/icons/PlugMetro.png"
                },
                new MainMenuItems
                {
                    Name  = L10n.Localize("ScheduleTitle"), Color = Color.Navy,
                    Image = "https://izy.meazon.com/app/content/img/icons/ScheduleMetro.png"
                },
                new MainMenuItems
                {
                    Name  = L10n.Localize("UsersTitle"), Color = Color.Green,
                    Image = "https://izy.meazon.com/app/content/img/icons/UsersMetro.png"
                },
                new MainMenuItems
                {
                    Name  = L10n.Localize("SettingsTitle"), Color = Color.Olive,
                    Image = "https://izy.meazon.com/app/content/img/icons/SettingsMetro.png"
                },
                new MainMenuItems
                {
                    Name  = L10n.Localize("AboutTitle"), Color = Color.Maroon,
                    Image = "https://izy.meazon.com/app/content/img/icons/about-light.png"
                }
            };

            return(Namelist);
        }
예제 #7
0
        private void IntializeFaq()
        {
            Q1.Text = L10n.Localize("q1");
            A1.Text = L10n.Localize("a1");
            Q2.Text = L10n.Localize("q2");


            A2.Text = L10n.Localize("a2");


            Q3.Text = L10n.Localize("q3");

            A3.Text = L10n.Localize("a3");

            Q4.Text  = L10n.Localize("q4");
            A4.Text  = L10n.Localize("a4");
            Q5.Text  = L10n.Localize("q5");
            A5.Text  = L10n.Localize("a5");
            Q6.Text  = L10n.Localize("q6");
            A6.Text  = L10n.Localize("a6");
            Q7.Text  = L10n.Localize("q7");
            A7.Text  = L10n.Localize("a7");
            Q8.Text  = L10n.Localize("q8");
            A8.Text  = L10n.Localize("a8");
            Q9.Text  = L10n.Localize("q9");
            A9.Text  = L10n.Localize("a9");
            Q10.Text = L10n.Localize("q10");
            A10.Text = L10n.Localize("a10");
        }
예제 #8
0
 public DevicesPage()
 {
     InitializeComponent();
     Title             = L10n.Localize("DevicesTitle");
     str               = new StateActionResources();
     devicesCollection = new ObservableCollection <Plug>();
     connection        = WebSocketFactory.Create();
 }
        public Privacy_Policy_Page()
        {
            InitializeComponent();
            Title = L10n.Localize("PrivacyLabel");
            var resource = new PrivacyResources();

            PrivacyLabel.Text = resource.ReturnPrivacyText();
        }
예제 #10
0
        private async void CoAdminListView_OnItemTapped(object sender, ItemTappedEventArgs e)
        {
            var action = await DisplayActionSheet(L10n.Localize("OptionsLabel"), L10n.Localize("CancelLabel"), "", L10n.Localize("DeleteLabel")
                                                  );

            if (string.Equals(L10n.Localize("DeleteLabel"), action))
            {
                Delete_OnClicked(e.Item);
            }
        }
예제 #11
0
        public SchedulesPage()
        {
            InitializeComponent();


            Title             = L10n.Localize("ScheduleTitle");
            devicesCollection = new ObservableCollection <Plug>();

            connection = Websockets.WebSocketFactory.Create();
            helper     = new ScheduleHelperClass();
        }
예제 #12
0
        public object ProvideValue(IServiceProvider serviceProvider)
        {
            if (Text == null)
            {
                return(null);
            }
            Debug.WriteLine("Provide: " + Text);
            // Do your translation lookup here, using whatever method you require
            var translated = L10n.Localize(Text, Text);

            return(translated);
        }
예제 #13
0
        //private async Task<string> returnTokenAsync()
        //{
        //    //string MtokenUrl = "https://izy.meazon.com/api/energylog/mToken";

        //    //using (var client = new HttpClient())
        //    //{
        //    //    //client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", App.USERTOKEN);
        //    //    //client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", App.USERTOKEN);
        //    //    //var token = await client.GetStringAsync(MtokenUrl);
        //    //    //token = token.Replace("\"", "");
        //    //    //return token;



        //    //}



        //}


        private async Task SelectActionState(string mac)
        {
            var act = await
                      DisplayAlert(L10n.Localize("AlertLabel"), L10n.Localize("DisableScheduleQuestion"),
                                   L10n.Localize("YesAction"), L10n.Localize("CancelLabel"));

            if (act)
            {
                string schOffMsg = "DisableSchedule {\"MAC\":" + mac + ",\"Number\":0}";
                connection.Send(schOffMsg);
            }
        }
예제 #14
0
        private async void Delete_OnClicked(object sender)
        {
            var adm = sender as CoAdmin;
            var act = await DisplayAlert(L10n.Localize("DeleteLabel"), L10n.Localize("DeleteAction"), L10n.Localize("YesAction"), L10n.Localize("NoAction"));

            if (act)
            {
                await res.DeleteAdminAsync(adm.Id);
            }
            Device.BeginInvokeOnMainThread(async() =>
            {
                CoAdminListView.ItemsSource = await res.GetAdminsAsync();
            });
        }
예제 #15
0
        public RenamePage(Plug device)
        {
            InitializeComponent();
            Title              = L10n.Localize("RenameTitle");
            SelectedDevice     = device;
            MyEntry.Text       = SelectedDevice.Name;
            CancelButton.Image = Device.OnPlatform(iOS: ImageSource.FromFile("Resources/Cancel.png"),
                                                   Android: ImageSource.FromFile("Resources/drawable/Cancel.png")
                                                   , WinPhone: ImageSource.FromFile("Assets/Cancel.png")) as FileImageSource;


            SaveButton.Image = Device.OnPlatform(iOS: ImageSource.FromFile("Resources/Check.png"),
                                                 Android: ImageSource.FromFile("Resources/drawable/Check.png")
                                                 , WinPhone: ImageSource.FromFile("Assets/Check.png")) as FileImageSource;
        }
예제 #16
0
        public SchedulePage(Plug plug)
        {
            InitializeComponent();
            Title = L10n.Localize("SchedulesTitle");
            InitializePlatformSpecific();

            Indicator.IsRunning = true;
            Indicator.IsVisible = true;
            MainStack.IsVisible = false;
            connection          = Websockets.WebSocketFactory.Create();
            p       = new Plug();
            _helper = new ScheduleHelperClass();

            p.Mac   = plug.Mac;
            p.Name  = plug.Name;
            _helper = new ScheduleHelperClass();
        }
예제 #17
0
        public string TranslateStateAction(string obj)
        {
            string action = "";

            if (string.Equals(L10n.Localize("State1"), obj))
            {
                action = "override";
            }
            if (string.Equals(L10n.Localize("State2"), obj))
            {
                action = "ask";
            }
            if (string.Equals(L10n.Localize("State3"), obj))
            {
                action = "nothing";
            }
            return(action);
        }
예제 #18
0
        private void SetValuesFromPreviousState(MySchedule s)
        {
            List <string> days = s.Days.Split(' ').ToList();

            foreach (var v in days)
            {
                if (string.Equals(v, L10n.Localize("MonLabel")))
                {
                    MonSwitch.IsToggled = true;
                }
                else if (string.Equals(v, L10n.Localize("TueLabel")))
                {
                    TueSwitch.IsToggled = true;
                }
                else if (string.Equals(v, L10n.Localize("WedLabel")))
                {
                    WedSwitch.IsToggled = true;
                }
                else if (string.Equals(v, L10n.Localize("ThuLabel")))
                {
                    ThuSwitch.IsToggled = true;
                }
                else if (string.Equals(v, L10n.Localize("FriLabel")))
                {
                    FriSwitch.IsToggled = true;
                }
                else if (string.Equals(v, L10n.Localize("SatLabel")))
                {
                    SatSwitch.IsToggled = true;
                }
                else if (string.Equals(v, L10n.Localize("SunLabel")))
                {
                    SunSwitch.IsToggled = true;
                }
            }



            var fromt = Helper.StringToQt(s.FromTime);
            var tot   = Helper.StringToQt(s.ToTime);

            InitializeValues(fromt, tot);
        }
예제 #19
0
        private async void Switch_OnToggled(object sender, ToggledEventArgs e)
        {
            var s = ((BindableObject)sender).BindingContext;

            if (s != null)
            {
                var p = (Plug)s;

                var stateaction = await str.GetStateAction();

                if (!string.Equals(stateaction, L10n.Localize("State3")))
                {
                    if (string.Equals(stateaction, L10n.Localize("State2")))
                    {
                        if (p.MyPlugState.IsScheduleEnabled != null && (bool)p.MyPlugState.IsScheduleEnabled)
                        {
                            await SelectActionState(p.Mac);
                        }
                    }
                    else if (string.Equals(stateaction, L10n.Localize("State1")))
                    {
                        string schOffMsg = "DisableSchedule {\"MAC\":" + p.Mac + ",\"Number\":0}";
                        connection.Send(schOffMsg);
                    }
                }


                if (e.Value == true)
                {
                    string turnOnMsg = "TurnOn {\"MAC\":" + p.Mac + ",\"Number\":0}";
                    connection.Send(turnOnMsg);
                }
                else if (e.Value == false)
                {
                    string turnOffMsg = "TurnOff {\"MAC\":" + p.Mac + ",\"Number\":0}";
                    connection.Send(turnOffMsg);
                }
            }
        }
예제 #20
0
        private async Task SetPage(string option)
        {
            if (string.Equals(option, L10n.Localize("DevicesTitle")))
            {
                Detail = new DevicesPage();
                Device.OnPlatform(iOS: IsPresented = false, Android: IsPresented = false,
                    WinPhone: IsPresented = true);
            }
            else if (string.Equals(option, L10n.Localize("SettingsTitle")))
            {
                Detail = new SettingsPage();
                Device.OnPlatform(iOS: IsPresented = false, Android: IsPresented = false,
                    WinPhone: IsPresented = true);

            }
            else if (string.Equals(option, L10n.Localize("ScheduleTitle")))
            {
                Detail = new SchedulesPage();
                Device.OnPlatform(iOS: IsPresented = false, Android: IsPresented = false,
                    WinPhone: IsPresented = true);
            }
            else if (string.Equals(option, L10n.Localize("AboutTitle")))
            {
                Detail = new AboutPage();
                Device.OnPlatform(iOS:IsPresented=false,Android:IsPresented=false,
                    WinPhone:IsPresented=true);

            }
            else if (string.Equals(option, L10n.Localize("UsersTitle")))
            {

                Detail = new UsersPage();
                Device.OnPlatform(iOS: IsPresented = false, Android: IsPresented = false,
                    WinPhone: IsPresented = true);
            }


        }
예제 #21
0
        public HomePage()
        {
            InitializeComponent();
            if (Device.OS == TargetPlatform.Android)
            {
                Master.Title = L10n.Localize("MasterTitleAndroid");
                //Master.Icon = "select.png";
                Master.Padding = 2;

            }
            else if (Device.OS == TargetPlatform.WinPhone)
            {
                Master.Title = L10n.Localize("MasterTitleAndroid"); 
                //Master.Icon = "swap.png";
            }
            else if (Device.OS == TargetPlatform.iOS)
            {
                Master.Title = L10n.Localize("MasterTitleAndroid"); 
                //Master.Title = "Resources/select.png";

            }
            else if (Device.OS == TargetPlatform.Windows)
            {
                Master.Title = L10n.Localize("MasterTitleAndroid");
                //Master.Icon = "Assets/select.png";

            }


            


            var r = new MenuResources();
            MenuList.ItemsSource = r.GetNames();

        }
예제 #22
0
        private int DayToIndex(string day)
        {
            int index;

            if (string.Equals(day, L10n.Localize("SatLabel")))
            {
                index = 0;
            }
            else if (string.Equals(day, L10n.Localize("SunLabel")))
            {
                index = 1;
            }
            else if (string.Equals(day, L10n.Localize("MonLabel")))
            {
                index = 2;
            }
            else if (string.Equals(day, L10n.Localize("TueLabel")))
            {
                index = 3;
            }
            else if (string.Equals(day, L10n.Localize("WedLabel")))
            {
                index = 4;
            }
            else if (string.Equals(day, L10n.Localize("ThuLabel")))
            {
                index = 5;
            }
            else
            {
                index = 6;
            }


            return(index);
        }
예제 #23
0
 public AddCoAdminPage()
 {
     InitializeComponent();
     Title = L10n.Localize("AddAdminTitle");
 }
예제 #24
0
 public AboutPage()
 {
     InitializeComponent();
     Title = L10n.Localize("AboutTitle");
 }
예제 #25
0
 public FaqPage()
 {
     InitializeComponent();
     Title = L10n.Localize("FaqFull");
     IntializeFaq();
 }
예제 #26
0
        private async Task <bool> CheckValidation()
        {
            var time = await CheckTimeValidation();

            if (!time)
            {
                await DisplayAlert("Wrong Time Set", "From time Value must be lower than To Time Value", L10n.Localize("OkAction"));
            }
            var day = MonSwitch.IsToggled || TueSwitch.IsToggled || WedSwitch.IsToggled || ThuSwitch.IsToggled ||
                      FriSwitch.IsToggled || SatSwitch.IsToggled || SunSwitch.IsToggled;

            if (!day)
            {
                await DisplayAlert("Wrong Day Schedule", "You must set at leasy one Day Schedule", L10n.Localize("OkAction"));
            }
            return(time & day);
        }
예제 #27
0
 public SettingsPage()
 {
     InitializeComponent();
     Title = L10n.Localize("SettingsTitle");
 }
예제 #28
0
 public UsersPage()
 {
     InitializeComponent();
     Title = L10n.Localize("UsersTitle");
 }