Esempio n. 1
0
 public override async Task<Widget> GetWidget()
 {
     StackOverflowWidget tw = new StackOverflowWidget(
         Properties["User Id"].Content,
         "stackoverflow");
     await tw.Update();
     return tw;
 }
Esempio n. 2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Notifícame cuando el usuario abra el panel de Settings
            if (!this.m_settingsReady)
            {
                SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;
                this.m_settingsReady = true;
            }

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;

            object NumWidgets = localSettings.Values["NumWidgets"];

            if (NumWidgets != null)
            {
                for (int i = 0; i < (int)NumWidgets; i++)
                {
                    ApplicationDataCompositeValue composite = (ApplicationDataCompositeValue)localSettings.Values["Widget" + i];
                    Widget w = Widget.CreateWidget(composite);
                    if (w != null)
                    {
                        w.Update();
                        this.Widgets.Add(w);
                    }
                }
            }

            object NewLoad = localSettings.Values["NewLoad"];
            if (NewLoad == null)
            {
                Widget w;

                w = new FacebookWidget("cocacola", FacebookWidget.Selection.Likes);
                w.Update();
                this.Widgets.Add(w);

                w = new GithubWidget("twitter", "bootstrap");
                w.Update();
                this.Widgets.Add(w);

                w = new FacebookWidget("microsoft", FacebookWidget.Selection.TalkingAbout);
                w.Update();
                this.Widgets.Add(w);

                w = new StackOverflowWidget("190165", "stackoverflow");
                w.Update();
                this.Widgets.Add(w);

                w = new GithubWidget("rails", "rails");
                w.Update();
                this.Widgets.Add(w);

            }

            // Create a Frame to act navigation context and navigate to the first page
            var rootFrame = new Frame();
            rootFrame.Navigate(typeof(MainPage));

            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = rootFrame;
            Window.Current.Activate();
            Window.Current.VisibilityChanged += Current_VisibilityChanged;
        }
Esempio n. 3
0
        public WidgetSource()
        {
            Widget w;

            w = new FacebookWidget("cocacola", FacebookWidget.Selection.Likes);
            w.Update();
            this._allWidgets.Add(w);

            w = new GithubWidget("twitter", "bootstrap");
            w.Update();
            this._allWidgets.Add(w);

            w = new FacebookWidget("microsoft", FacebookWidget.Selection.TalkingAbout);
            w.Update();
            this._allWidgets.Add(w);

            w = new StackOverflowWidget("190165", "stackoverflow");
            w.Update();
            this._allWidgets.Add(w);

            w = new GithubWidget("rails", "rails");
            w.Update();
            this._allWidgets.Add(w);
        }