Exemplo n.º 1
0
		private async Task<Session> Accept()
		{

			AChannel channel = await this.Service.AcceptChannel();
			Session session = new Session(this, channel);
			channel.ErrorCallback += (c, e) => { this.Remove(session.Id); };
			this.sessions.Add(session.Id, session);
			return session;
		}
        public PreferencesWindow(Session session) {
            Log.Debug("ctor");
            Build();

            AddTooltips();

            Title += VersionHelper.GetVersionString();
            Preferences = session.Preferences;
            User = session.User;

            this._presenter = Bootstrapper.GetPresenter<IPreferencesView, IPreferencesPresenter>(this);

            SetCacheSize();
        }
        public BrowserWindow(Session session) {
            Log.Debug("ctor");
            Build();

            AddTooltips();

            this.photosGrid.OnSelectionChanged += OnSelectionChanged;

            Title += VersionHelper.GetVersionString();

            User = session.User;
            Preferences = session.Preferences;
            CurrentPhotoset = session.SelectedPhotoset;

            AllSelectedPhotos = new Dictionary<string, Dictionary<string, Photo>>();

            AddSpinnerWidget();

            this._presenter = Bootstrapper.GetPresenter<IBrowserView, IBrowserPresenter>(this);
            this._presenter.InitializePhotoset();
        }
        public LandingWindow(Session session) {
            Log.Debug("ctor");
            Build();

            AddTooltips();

            this.photowidgetPublic.SelectionChanged += OnPublicSetSelectionChanged;
            this.photowidgetPrivate.SelectionChanged += OnPrivateSetSelectionChanged;
            this.albumsGrid.OnSelectionChanged += OnAlbumsSelectionChanged;

            this.hboxPublicPrivate.Visible = false;
            this.vbox1.Visible = false; // All Public Photos
            this.vbox3.Visible = false; // All Photos
            this.scrolledwindowPhotos.Visible = this.labelSets.Visible = false; // Albums;

            Title += VersionHelper.GetVersionString();
            Preferences = session.Preferences;
            User = session.User;

            AddSpinnerWidget();

            this._presenter = Bootstrapper.GetPresenter<ILandingView, ILandingPresenter>(this);
            this._presenter.Initialize();
        }
Exemplo n.º 5
0
        public List <Model.Session> GetByConference(int confId)
        {
            List <Model.Session> all = new List <Model.Session>();


            foreach (var s in _context.getSessionsForConference(confId))
            {
                List <Model.Reservation> reservations = new List <Model.Reservation>();

                foreach (var p in _context.getPapersSession(s.SessionId))
                {
                    User        u     = _context.Users.Find(p.UserId);
                    Model.User  user  = new Model.User(u.UserId, u.Username, u.Password, u.Name, u.Affilliation, u.Email, u.canBePCMember, u.WebPage);
                    Model.Paper paper = new Model.Paper(p.PaperId, confId, user, p.Name, p.Filepath, p.Domain, p.Subdomain, p.Resume, p.TopicName);

                    List <Author> authors = new List <Author>();

                    foreach (var a in _context.getAdditionalAuthors(p.PaperId))
                    {
                        Author au = new Author(0, a.Name, a.Affiliation);
                        authors.Add(au);
                    }
                    paper.AdditionalAuthors = authors;

                    foreach (var b in _context.getBidsResult(p.PaperId))
                    {
                        User        use         = _context.Users.Find(b.PCMemberUserId);
                        PCMember    pcm         = _context.PCMembers.Find(b.PCMemberUserId, confId);
                        Model.User  userr       = new Model.User(use.UserId, use.Username, use.Password, use.Name, use.Affilliation, use.Email, use.canBePCMember, use.WebPage);
                        Participant participant = new Participant(userr, confId, pcm.isChair, pcm.isCoChair, true, false);

                        paper.AddBid(participant, b.BiddingEvaluation);
                    }

                    foreach (var r in _context.getReviewsPaper(p.PaperId))
                    {
                        User        use         = _context.Users.Find(r.PCMemberUserId);
                        PCMember    pcm         = _context.PCMembers.Find(r.PCMemberUserId, confId);
                        Model.User  userr       = new Model.User(use.UserId, use.Username, use.Password, use.Name, use.Affilliation, use.Email, use.canBePCMember, use.WebPage);
                        Participant participant = new Participant(userr, confId, pcm.isChair, pcm.isCoChair, true, false);

                        Model.Review rev = new Model.Review(0, participant, (Verdict)r.Evaluation, r.Recommandations);
                        paper.AddReview(rev);
                        paper.AddReviewer(participant);
                    }

                    foreach (var res in _context.getReservationPaper(paper.Id))
                    {
                        string room = "Room: " + res.RoomName + ", Street: " + res.Street + ", City: " + res.City;

                        Reservation rv = new Reservation(0, paper, room, DateTime.Parse(res.Timp.ToString()), res.Duration, DateTime.Parse(res.Data.ToString()));
                        reservations.Add(rv);
                    }
                }

                User        us       = _context.Users.Find(s.SessionChairId);
                PCMember    pc       = _context.PCMembers.Find(s.SessionChairId, confId);
                Model.User  user2    = new Model.User(us.UserId, us.Username, us.Password, us.Name, us.Affilliation, us.Email, us.canBePCMember, us.WebPage);
                Participant sesChair = new Participant(user2, confId, pc.isChair, pc.isCoChair, true, false);

                Model.Session se = new Model.Session(s.SessionId, reservations, sesChair);

                all.Add(se);
            }


            return(all);
        }
Exemplo n.º 6
0
		/// <summary>
		/// 创建一个新Session
		/// </summary>
		public Session Create(string address)
		{
			string[] ss = address.Split(':');
			int port = int.Parse(ss[1]);
			string host = ss[0];
			AChannel channel = this.Service.ConnectChannel(host, port);
			Session session = new Session(this, channel);
			channel.ErrorCallback += (c, e) => { this.Remove(session.Id); };
			this.sessions.Add(session.Id, session);
			return session;
		}
		public void Handle(Session session, MessageInfo messageInfo)
		{
			List<IMHandler> actions;
			if (!this.handlers.TryGetValue(messageInfo.Opcode, out actions))
			{
				Log.Error($"消息 {messageInfo.Opcode} 没有处理");
				return;
			}

			Type messageType = this.GetType(messageInfo.Opcode);
			object message = MongoHelper.FromBson(messageType, messageInfo.MessageBytes, messageInfo.Offset, messageInfo.Count);
			messageInfo.Message = message;

			foreach (IMHandler ev in actions)
			{
				try
				{
					ev.Handle(session, messageInfo);
				}
				catch (Exception e)
				{
					Log.Error(e.ToString());
				}
			}
		}