Пример #1
0
        private void backgroundLoginWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (Session == null)
            {
                String   vmosoHost = Properties.Settings.Default.VmosoHost;
                FileInfo hostFile  = new FileInfo(dataFolder + "/host");
                if (hostFile.Exists)
                {
                    vmosoHost = File.ReadAllText(hostFile.FullName);
                    ServicePointManager.ServerCertificateValidationCallback += (sdr, certificate, chain, sslPolicyErrors) => true;
                }

                String   vmosoCid = Properties.Settings.Default.VmosoCid;
                FileInfo cidFile  = new FileInfo(dataFolder + "/cid");
                if (cidFile.Exists)
                {
                    vmosoCid = File.ReadAllText(cidFile.FullName);
                }

                log.Info("Creating session for host " + vmosoHost);
                Session = new VmosoSession(vmosoHost, vmosoCid);
                //if (Properties.Settings.Default.UseProxy) {
                //	Session.setProxy(Properties.Settings.Default.ProxyHost, Properties.Settings.Default.ProxyPort, Properties.Settings.Default.ProxyUser, Properties.Settings.Default.ProxyPassword);
                //}

                try {
                    log.Info("Login with username " + Properties.Settings.Default.VmosoUsername);
                    Session.Login(Properties.Settings.Default.VmosoUsername, Properties.Settings.Default.VmosoPassword);
                } catch (ApiException ex) {
                    log.Error("Login error", ex);
                    Exception ex2 = new Exception(Properties.Resources.error_login, ex);
                    e.Result = ex2;
                }
            }

            try {
                log.Info("Getting user info for username " + Properties.Settings.Default.VmosoUsername);
                UserApi userApi = new UserApi(Session.GetApiClient());

                GetMeResult result = userApi.GetMe();
                if (result.Hdr.Rc == 0)
                {
                    log.Info("User " + result.DisplayRecord.DisplayName + " logged");
                    e.Result = result.DisplayRecord.DisplayName;
                }
                else
                {
                    Exception ex2 = new Exception(Properties.Resources.error_login);
                    log.Error("Vmoso error getting user info. Rc=" + result.Hdr.Rc);
                    e.Result = ex2;
                }
            } catch (Exception ex) {
                Exception ex2 = new Exception(Properties.Resources.error_login);
                log.Error("Error getting user info", ex);
                e.Result = ex2;
            }
        }
Пример #2
0
        public void Add(VmosoTileDisplayRecord displayRecord, VmosoSession session)
        {
            notifierQueue.Enqueue(displayRecord);

            if (add != null)
            {
                add(this, new NotifierEventArgs(displayRecord, session));
            }
        }
Пример #3
0
 public NotifierUIManager(VmosoSession session)
 {
     this.Session = session;
     this.add    += new NotifierEventHandler(OnAdd);
     top          = new Point();
     workingArea  = Screen.GetWorkingArea(this);
     showMessageTimer.Interval = 1000;
     showMessageTimer.Tick    += ShowMessageTimerOnTick;
     this.expectedSize         = new Size((int)(workingArea.Width * 0.14), (int)(workingArea.Height * 0.1));
     top.X         = workingArea.X + workingArea.Width - expectedSize.Width;
     top.Y         = workingArea.Y + workingArea.Height;
     realBarHeight = expectedSize.Height;
 }
Пример #4
0
 public AHAClient(VmosoSession session)
 {
     log.Debug("Creating AHAClient for host/userKey " + session.Host + "/" + session.UserKey);
     this.session = session;
 }
Пример #5
0
 public PersonalPane(Size expectedSize, VmosoTileDisplayRecord displayRecord, VmosoSession session)
     : base(expectedSize, displayRecord)
 {
     this.Session = session;
     Initialize();
 }
Пример #6
0
 public PushClient(VmosoSession session)
 {
     this.session    = session;
     this.urlBuilder = new DirectUrlBuilder(session.OriginalHost);
 }
Пример #7
0
 public NotifierEventArgs(VmosoTileDisplayRecord displayRecord, VmosoSession session)
 {
     this.DisplayRecord = displayRecord;
     this.Session       = session;
 }
Пример #8
0
 public VmosoNotifierTile(Point startRenderPoint, VmosoTileDisplayRecord displayRecord, Size expectedSize, VmosoSession session)
     : base(startRenderPoint, displayRecord, expectedSize)
 {
     this.Session = session;
     InitializeVmosoTile();
 }