Ejemplo n.º 1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public Main()
        {
            InitializeComponent();

            //special case of screenshot mode
            if (SessionInfo.Get().ScreenshotMode)
            {
                var discId = SessionInfo.Get().screenDiscId;
                PrivateCenterCtx.sharedClient = sharedClient;
                PublicBoardCtx.sharedClient   = sharedClient;
                SessionInfo.Get().discussion = PrivateCenterCtx.Get().Discussion.FirstOrDefault(d => d.Id == discId);
                SessionInfo.Get().setPerson(PrivateCenterCtx.Get().Person.FirstOrDefault(p => p.Name == "moderator"));
                var loginRes = new LoginResult();
                loginRes.devType    = DeviceType.Wpf;
                loginRes.discussion = SessionInfo.Get().discussion;
                loginRes.person     = SessionInfo.Get().person;
                sharedClient.start(loginRes, PrivateCenterCtx.Get().Connection.DataSource, DeviceType.Wpf);

                this.Hide();

                sharedClient.clienRt.onJoin += () =>
                {
                    PublicCenter pubCenter = new PublicCenter(UISharedRTClient.Instance,
                                                              () => { },
                                                              SessionInfo.Get().screenTopicId,
                                                              SessionInfo.Get().screenDiscId
                                                              );

                    pubCenter.Show();
                    pubCenter.Hide();

                    Task <PublicCenter.ScreenshoReports> t = pubCenter.FinalSceneScreenshots();
                    t.GetAwaiter().OnCompleted(() =>
                    {
                        pubCenter.Close();
                        pubCenter = null;

                        var reports = t.Result;
                        Utils.ScreenshotPackToMetaInfo(reports, SessionInfo.Get().screenMetaInfo);
                        Application.Current.Shutdown();
                    });
                };
                return;
            }

            lblVersion.Content = Utils2.VersionString();

            DataContext = this;

            PrivateCenterCtx.sharedClient = sharedClient;
            PublicBoardCtx.sharedClient   = sharedClient;

            avatar.pointDown = AvatarPointDown;

            foreach (EventViewModel evm in DaoUtils.GetRecentEvents())
            {
                RecentEvents.Insert(0, evm);
            }

            LoginProcedures();

            lstBxPlayers.ItemsSource = UsersStatus;
        }