Connection to network service using HTTP client.
Inheritance: MeshPortal
Ejemplo n.º 1
0
        /// <summary>
        /// Initialize the class, called once when dialog is created.
        /// </summary>
        public override void Initialize() {

            if (DoLocal) {
                MeshPortal.Default = new MeshPortalDirect();
                }

            else {
                JPCProvider.LocalLoopback = false;
                var Portal = new MeshPortalRemote();
                MeshPortal.Default = Portal;
                }


            //DevProfile = SignedDeviceProfile.GetLocal(Pending);

            if (DevProfile == null) {
                DevProfile = new SignedDeviceProfile(Device1, Device1Description);
                DevProfile.ToRegistry(Pending);
                }

            }
Ejemplo n.º 2
0
        /// <summary>
        /// One time initialization of the page.
        /// </summary>
        public override void Initialize() {

            // Get the device profile or create a new one if necessary.
            ThisDevice = SignedDeviceProfile.GetLocal(Device1, Device1Description);



            if (DoLocal) {
                MeshPortal.Default = new MeshPortalDirect();

                // Get the default profile if possible
                MeshClient = new MeshClient(); // default account
                MeshClient.AccountID = AccountID;

                if (MeshClient.Connected) {
                    AccountName = MeshClient.AccountName;
                    Portal = MeshClient.Portal;
                    SignedCurrentProfile = SignedPersonalProfile.GetLocal(MeshClient.UDF);
                    Navigate(Data_SetupComplete);
                    }
                }


            else {

                JPCProvider.LocalLoopback = false;
                var Portal = new MeshPortalRemote();
                MeshPortal.Default = Portal;


                }


            }
Ejemplo n.º 3
0
        public void MeshStoreAPI() {

            if (DoLocal) {
                File.Delete(Store);
                File.Delete(Portal);
                MeshPortal.Default = new MeshPortalDirect(Store, Portal);
                }
            else {
                JPCProvider.LocalLoopback = false;
                var Portal = new MeshPortalRemote();
                MeshPortal.Default = Portal;
                }


            MeshClient1 = new MeshClient(Service);
            var valid = MeshClient1.Validate(AccountID);
            if (!valid.Status.StatusSuccess()) {
                Console.WriteLine("Validate failed");
                }

            var DevProfile = new SignedDeviceProfile(Device1, Device1Description);
            var UserProfile = new PersonalProfile(DevProfile);
            var SignedProfile = UserProfile.Signed;

            MeshClient1.CreatePersonalProfile(AccountID, SignedProfile);

            // Create a password profile
            //var PasswordProfile = new PasswordProfile(UserProfile);
            //var SignedPasswordProfile = PasswordProfile.Signed;
            //SignedProfile = UserProfile.Signed;

            //MeshClient1.Publish(SignedPasswordProfile);
            //MeshClient1.Publish(SignedProfile);


            MeshClient2 = new MeshClient(Service, AccountID);
            MeshClient2.SignedDeviceProfile = DevProfile;
            MeshClient2.GetPersonalProfile();

            // Read back the password profile and add entry 
            var AccountPasswordProfile = MeshClient2.GetPasswordProfile();
            AccountPasswordProfile.Add(PWDSite, PWDUser, PWDPassword);
            var AccountSignedPassword = AccountPasswordProfile.Signed;



            // Publish updates to both profiles.
            MeshClient2.Publish(AccountSignedPassword);

            // Create a new device profile.
            var DevProfile2 = new SignedDeviceProfile(Device2, Device2Description);

            MeshClient3 = new MeshClient(Service, AccountID);

            MeshClient3.ConnectRequest(DevProfile2);
            MeshClient2.ConnectStatus(DevProfile2.UniqueID);

            var PendingResponse = MeshClient1.ConnectPending();

            foreach (var Request in PendingResponse.Pending) {
                MeshClient1.ConnectClose(Request, ConnectionStatus.Accepted);
                }

            MeshClient3.ConnectStatus(DevProfile2.UniqueID);

            MeshClient3.GetPasswordProfile();

            }