public static async Task <SiteProfileManager> Open(string profileId, bool createIfNotExist = false)
        {
            if (String.IsNullOrEmpty(profileId))
            {
                return(null);
            }

            bool isSuccess = await OpenSiteProfileFolder(profileId, createIfNotExist);

            if (isSuccess)
            {
                SiteProfileManager siteManager = new SiteProfileManager(profileId);
                isSuccess = await siteManager.LoadSessionConfig();

                if (isSuccess)
                {
                    Debug.WriteLine("InitSiteManager success!");
                }
                else
                {
                    Debug.WriteLine("InitSiteManager failed!");
                }
                return(siteManager);
            }
            return(null);
        }
Example #2
0
        /// <summary>
        /// On page loaded
        /// <summary>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SiteProfileManager siteManager = SiteProfileManager.DefaultSiteProfileManager;

            if (siteManager == null)
            {
                siteManager = await SiteProfileManager.Open(App.SiteProfileId);

                SiteProfileManager.SetDefault(siteManager);
            }
            else
            {
                var action = e.Parameter as string;
                if (!String.IsNullOrEmpty(action) && action == "RELOAD")
                {
                    await siteManager.LoadSessionConfig();
                }
            }

            listviewSessionStatus.Items.Clear();

            if (siteManager?.sessionConfig?.sessions != null)
            {
                sessionConfig = siteManager.sessionConfig;
                foreach (var session in sessionConfig.sessions)
                {
                    SessionStatusInfo sessionInfoItem = new SessionStatusInfo()
                    {
                        Name        = session.sessionName,
                        SourceUrl   = String.Format("{0}", session.sourceType.ToString()),
                        Description = String.Empty,
                        Status      = 0,
                        IsActive    = false,
                        Session     = session,
                    };

                    listSessionStatus.Add(sessionInfoItem);
                    listviewSessionStatus.Items.Add(sessionInfoItem);
                }
            }
        }