Esempio n. 1
0
	    public static void UpdateTokenInfo(string token)
	    {
	        TokenDatabase database;
	        List<TokeInformation> lstTokeInformations;
	        try
	        {
	            database = new TokenDatabase();
	            lstTokeInformations = database.GetItems().ToList();
	            if (lstTokeInformations.Any())
	            {
	                var item = lstTokeInformations.FirstOrDefault();
	                item.access_token = token;
	                database.SaveItem(item);
	            }
	        }
	        catch (Exception ex)
	        {
	            throw new Exception(message: ex.Message);
	        }
	        finally
	        {
	            database = null;
	            lstTokeInformations = null;
	        }


	    }
Esempio n. 2
0
        public static string GetTokenInfo()
        {
            string accToken = "";
            TokenDatabase database;
            List<TokeInformation> lstTokeInformations;
            try
            {
                database = new TokenDatabase();
                lstTokeInformations = database.GetItems().ToList();
                if (lstTokeInformations.Any())
                {
                    var item = lstTokeInformations.FirstOrDefault();
                    accToken = item.access_token;
                }
                return accToken;
            }
            catch (Exception ex)
            {
                throw new Exception(message: ex.Message);
            }
            finally
            {
                database = null;
                lstTokeInformations = null;
            }

        }
Esempio n. 3
0
        public LoginPage()
        {
            ViewModel = new BaseViewModel{};
            BindingContext = ViewModel;
            DeviceDetail.UserKey = "";
			_database = new TokenDatabase();
            
            var layout = new StackLayout { Padding = 10};
           _message = new Label
            {
                Text = "",
                FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Label)),
                VerticalOptions = LayoutOptions.Center,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,
                TextColor = Color.Red
            };
            
            var imgLogoImage = new Image {Source = "ecs.png"};
            layout.Children.Add(imgLogoImage);
            
			var spacer = new Label
			{
				Text = "",
				FontSize = 15,
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center,

			};


            var version = new Label
            {
                Text = "Version (0.0.0.2)",
				FontFamily = "HelveticaNeue-Medium",
                FontSize = 15,
				FontAttributes = FontAttributes.Bold,
                VerticalOptions = LayoutOptions.Center,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,
                
            };
			layout.Children.Add (spacer);
            layout.Children.Add(version);

            _username = new Entry { Placeholder = "Username"};
            layout.Children.Add(_username);
            
            _password = new Entry { Placeholder = "Password", IsPassword = true };
            layout.Children.Add(_password);

            loginButton = new Button { Text = "Sign In" };
            loginButton.Clicked += async (sender, args) => await ValidateUser(_username.Text, _password.Text);
            layout.Children.Add(loginButton);
            layout.Children.Add(_message);

            
            // here's your activity indicator, it's bound to the IsBusy property of the BaseViewModel
            // those bindings are on both the visibility property as well as the IsRunning property
            var activityIndicator = new ActivityIndicator
            {
                Color = Color.Black
            };
            activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            layout.Children.Add(activityIndicator);

            var placeHolder = new Label
            {
                Text = "This software is proprietary and confidential to ECS and by using this software you agree that no part of the document that you would view may be disclosed in any manner to a third party without the prior written consent.",
                FontSize = Device.GetNamedSize(NamedSize.Default, typeof (Label)),
                VerticalOptions = LayoutOptions.Center,
                TextColor = Color.Black
            };
            layout.Children.Add(placeHolder);
            
            Content = new ScrollView()
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.Start,
                Content = layout
                
            };
           

        }