Esempio n. 1
0
        private void RefreshUserList()
        {
            cmbEmail.Items.Clear();
            try
            {
                menuGotoTimeline.DropDownItems.Remove(menuNewUser);
                menuGotoTimeline.DropDownItems.Clear();

                List <UserLoginSetting> userlogins = new List <UserLoginSetting>();
                bool addSeparator      = false;
                ListDriverResponse res = StationController.ListUser();
                foreach (Driver driver in res.drivers)
                {
                    UserLoginSetting userlogin = userloginContainer.GetUserLogin(driver.email);
                    if (userlogin != null)
                    {
                        if (!addSeparator)
                        {
                            menuGotoTimeline.DropDownItems.Insert(0, new ToolStripSeparator());
                            addSeparator = true;
                        }
                        cmbEmail.Items.Add(userlogin.Email);
                        ToolStripMenuItem menu = new ToolStripMenuItem(userlogin.Email, null, menuSwitchUser_Click);
                        menu.Name = userlogin.Email;
                        menuGotoTimeline.DropDownItems.Insert(0, menu);
                        userlogins.Add(userlogin);
                    }
                }

                if (userlogins.Count > 0)
                {
                    string lastlogin = userloginContainer.GetLastUserLogin().Email;
                    userloginContainer.ResetUserLoginSetting(userlogins, lastlogin);
                }
            }
            finally
            {
                menuGotoTimeline.DropDownItems.Add(menuNewUser);
            }
        }
        public static ListDriverResponse ListUser()
        {
            try
            {
                ListDriverResponse res = CloudServer.request <ListDriverResponse>(
                    new WebClient(),
                    StationMgmtURL + "station/drivers/list",
                    new Dictionary <object, object>
                {
                    { CloudServer.PARAM_API_KEY, CloudServer.APIKey },
                }
                    );

                return(res);
            }
            catch (WammerCloudException e)
            {
                ExtractApiRetMsg(e);

                throw;
            }
        }