Example #1
0
        private void SetSessionStorage()
        {
            var userContext        = SettingStorage.Instance.GetValue <AuthorizatioUserModel>(StorageConstants.USER_CONTEXT_KEY);
            var deviceContext      = SettingStorage.Instance.GetValue <DeviceContextModel>(StorageConstants.DEVICE_CONTEXT_KEY);
            var accountAssociation = SettingStorage.Instance.GetValue <AccountAssociationModel>(StorageConstants.ACCOUNT_ASSOCIATION_KEY);

            if (userContext != null)
            {
                SessionStorage.Instance.UserContext = userContext;
            }


            if (deviceContext == null)
            {
                deviceContext = new DeviceContextModel();

                SettingStorage.Instance.AddOrUpdateValue(StorageConstants.DEVICE_CONTEXT_KEY, deviceContext);
            }

            SessionStorage.Instance.DeviceContext = deviceContext;

            if (accountAssociation != null)
            {
                SessionStorage.Instance.Set(StorageConstants.ACCOUNT_ASSOCIATION_KEY, accountAssociation);
            }
        }
Example #2
0
        public ClientContext()
        {
            ContextModel = new DeviceContextModel()
            {
                Username    = Program.Data["username"],
                MachineName = Environment.MachineName
            };

            Program.Socket.Register(this.ContextModel);

            /*
             * foreach(var camp in Program.API.GetCampaigns())
             * {
             * if (camp.IsCampaignActive) camp.Stop();
             * var campContext = new CampaignContext();
             * campContext.ActiveCampaigns.Add(camp);
             * Campaigns.Add(campContext);
             * }
             */
        }
Example #3
0
 public void Register(DeviceContextModel context) => this.Send(new SocketRegistrationModel()
 {
     Context = context
 }.Instantiate());