Esempio n. 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            SignOutButton.TouchUpInside += SignOutButtonClick;

            PasswordActionButton.TouchUpInside   += PasswordActionClick;
            PasswordCancelButton.TouchUpInside   += PasswordCancelClick;
            FullNameActionButton.TouchUpInside   += FullNameActionClick;
            FullNameCancelButton.TouchUpInside   += FullNameCancelClick;
            MacAddressActionButton.TouchUpInside += MacAddressActionClick;
            MacAddressCancelButton.TouchUpInside += MacAddressCancelClick;

            PiConnectionStringTextBox.EditingChanged += OnTextChangedResetConnectionString;

            UsernameTextBox.Text           = _userPrivate.Id;
            PasswordTextBox.Text           = _userPrivate.Password;
            FullNameTextBox.Text           = _userPublic.FullName;
            MacAddressTextBox.Text         = _userPublic.MacAddress;
            PiConnectionStringTextBox.Text = IoTClientManager.GetPiConnectionString(_userPublic.Id);

            _informationLabelMessage = StringConstants.EditInformationMessage;

            if (TextBoxes == null)
            {
                TextBoxes = new Dictionary <InputType, UITextField>();
                TextBoxes[InputType.Password]   = PasswordTextBox;
                TextBoxes[InputType.FullName]   = FullNameTextBox;
                TextBoxes[InputType.MacAddress] = MacAddressTextBox;
            }
            if (ActionButtons == null)
            {
                ActionButtons = new Dictionary <InputType, UIButton>();
                ActionButtons[InputType.Password]   = PasswordActionButton;
                ActionButtons[InputType.FullName]   = FullNameActionButton;
                ActionButtons[InputType.MacAddress] = MacAddressActionButton;
            }
            if (CancelButtons == null)
            {
                CancelButtons = new Dictionary <InputType, UIButton>();
                CancelButtons[InputType.Password]   = PasswordCancelButton;
                CancelButtons[InputType.FullName]   = FullNameCancelButton;
                CancelButtons[InputType.MacAddress] = MacAddressCancelButton;
            }
        }
Esempio n. 2
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            Instance = this;

            //Initialize the databases and IoTManager
            IoTClientManager.InitIoTClientManager();
            SignInManager.InitSignInManager();

            Storyboard = UIStoryboard.FromName("SignIn", null);
            SignInViewController signInViewController = Storyboard.InstantiateInitialViewController() as SignInViewController;

            Window.RootViewController = signInViewController;
            Window.MakeKeyAndVisible();

            return(true);
        }
Esempio n. 3
0
        public void ScanButtonClick(object sender, EventArgs e)
        {
            List <UserPublic> scannedUsers = null;

            string message;

            if (IoTClientManager.IsDeviceConnected(_selectedPiID, out message))
            {
                scannedUsers = IoTClientManager.ScanMethod(_selectedPiID);
            }
            else
            {
                InformationLabel.TextColor = UIColor.Red;
                _message = message;
                return;
            }

            if (scannedUsers == null)
            {
                InformationLabel.TextColor = UIColor.Red;
                _message = string.Format(StringConstants.SomethingWentWrongWhileScanning, _selectedPiPerferedName);
                return;
            }

            List <string> newScans = new List <string>();

            foreach (UserPublic user in scannedUsers)
            {
                newScans.Add($"{user.FullName} ({user.Id})");
            }

            IsHomeTableView.Source = new IsHomeTableSource(newScans.ToArray());
            IsHomeTableView.ReloadData();

            InformationLabel.TextColor = UIColor.DarkGray;
            _message = string.Format(StringConstants.ScanSuccessfulMessage, _selectedPiPerferedName);
        }