Exemple #1
0
        /// <summary>
        /// Create content items and add to the display
        /// </summary>
        /// <param name="refreshOnly">true if the item counter should not be
        /// incremented, false if it should be incremented
        /// </param>
        void ChangeItems(bool refreshOnly)
        {
            // add content to display.
            int maxItems = (firstTime) ? 1 : 1;

            firstTime = false;

            IGoogleDesktopDisplayPluginHelper pluginHelper =
                (IGoogleDesktopDisplayPluginHelper)this;

            // Here we show absolute time for items in email layout
            GoogleDesktopDisplayContentItemFlags itemFlags =
                GoogleDesktopDisplayContentItemFlags.GDD_CONTENT_ITEM_FLAG_NONE;

            if (contentLayout ==
                GoogleDesktopDisplayContentItemLayout.GDD_CONTENT_ITEM_LAYOUT_EMAIL)
            {
                itemFlags =
                    GoogleDesktopDisplayContentItemFlags.GDD_CONTENT_ITEM_FLAG_TIME_ABSOLUTE;
            }

            for (int j = 0, i = itemStart + itemRotate; j < maxItems; ++j, ++i)
            {
                // create a new item
                SamplePluginContentItem curItem = new SamplePluginContentItem();
                IGoogleDesktopDisplayContentItemHelper itemHelper =
                    (IGoogleDesktopDisplayContentItemHelper)curItem;

                // the strings to display, different format for odd and even numbered items
                String heading = "Line " + i + " line " + i + " line " + i;
                String source  = "Google";
                String snippet =
                    "Google doodles with the idea to create noodles to sell on Froogle.";

                stdole.IPicture image = null;
                if (showImages)
                {
                    // use different images for odd and even numbered items
                    bool oddNumberedItem = ((i % 2) == 1);
                    image = (oddNumberedItem) ? contentIcon1 : contentIcon2;
                }

                DateTime timeCreated = DateTime.UtcNow;

                // Show the item in the sidebar and optionally in the notifier window
                // if the sidebar was auto-hidden.
                GoogleDesktopContentItemDisplayOptions options =
                    GoogleDesktopContentItemDisplayOptions.GDD_ITEM_DISPLAY_IN_SIDEBAR |
                    GoogleDesktopContentItemDisplayOptions.GDD_ITEM_DISPLAY_AS_NOTIFICATION_IF_SIDEBAR_HIDDEN;
                pluginHelper.AddContentItem(curItem, options);

                // do the actual setting of properties
                itemHelper.heading      = heading;
                itemHelper.tooltip      = heading;
                itemHelper.source       = source;
                itemHelper.time_created = timeCreated;
                itemHelper.snippet      = snippet;
                itemHelper.flags        = itemFlags;
                itemHelper.image        = image;
                itemHelper.layout       = contentLayout;
            }

            if (!refreshOnly)
            {
                // increment item counter since we are asked to add new content
                itemRotate              = (itemRotate + maxItems) % itemRotateMax;
                totalItemsCreatedCount += maxItems;
            }

            // if we are in minimized mode, update the title with latest info.
            // displaySite will be null until plugin is fully initialized.
            if (displaySite != null && displaySite.display_state ==
                GoogleDesktopDisplayTileDisplayState.GDD_TILE_DISPLAY_STATE_MINIMIZED)
            {
                UpdateTitle();
            }
        }
        /// <summary>
        /// Create content items and add to the display
        /// </summary>
        /// <param name="refreshOnly">true if the item counter should not be
        /// incremented, false if it should be incremented
        /// </param>
        void ChangeItems(bool refreshOnly)
        {
            // add content to display.
              int maxItems = (firstTime) ? 1 : 1;
              firstTime = false;

              IGoogleDesktopDisplayPluginHelper pluginHelper =
            (IGoogleDesktopDisplayPluginHelper)this;

              // Here we show absolute time for items in email layout
              GoogleDesktopDisplayContentItemFlags itemFlags =
            GoogleDesktopDisplayContentItemFlags.GDD_CONTENT_ITEM_FLAG_NONE;
              if (contentLayout ==
              GoogleDesktopDisplayContentItemLayout.GDD_CONTENT_ITEM_LAYOUT_EMAIL) {
            itemFlags =
              GoogleDesktopDisplayContentItemFlags.GDD_CONTENT_ITEM_FLAG_TIME_ABSOLUTE;
              }

              for (int j = 0, i = itemStart + itemRotate; j < maxItems; ++j, ++i) {
            // create a new item
            SamplePluginContentItem curItem = new SamplePluginContentItem();
            IGoogleDesktopDisplayContentItemHelper itemHelper =
              (IGoogleDesktopDisplayContentItemHelper)curItem;

            // the strings to display, different format for odd and even numbered items
            String heading = "Line " + i + " line " + i + " line " + i;
            String source = "Google";
            String snippet =
              "Google doodles with the idea to create noodles to sell on Froogle.";

            stdole.IPicture image = null;
            if (showImages) {
              // use different images for odd and even numbered items
            bool oddNumberedItem = ((i % 2) == 1);
              image = (oddNumberedItem) ? contentIcon1 : contentIcon2;
            }

            DateTime timeCreated = DateTime.UtcNow;

            // Show the item in the sidebar and optionally in the notifier window
            // if the sidebar was auto-hidden.
            GoogleDesktopContentItemDisplayOptions options =
            GoogleDesktopContentItemDisplayOptions.GDD_ITEM_DISPLAY_IN_SIDEBAR |
            GoogleDesktopContentItemDisplayOptions.GDD_ITEM_DISPLAY_AS_NOTIFICATION_IF_SIDEBAR_HIDDEN;
            pluginHelper.AddContentItem(curItem, options);

            // do the actual setting of properties
            itemHelper.heading = heading;
            itemHelper.tooltip = heading;
            itemHelper.source = source;
            itemHelper.time_created = timeCreated;
            itemHelper.snippet = snippet;
            itemHelper.flags = itemFlags;
            itemHelper.image = image;
            itemHelper.layout = contentLayout;

              }

              if (!refreshOnly) {
            // increment item counter since we are asked to add new content
            itemRotate = (itemRotate + maxItems) % itemRotateMax;
            totalItemsCreatedCount += maxItems;
              }

              // if we are in minimized mode, update the title with latest info.
              // displaySite will be null until plugin is fully initialized.
              if (displaySite != null && displaySite.display_state ==
              GoogleDesktopDisplayTileDisplayState.GDD_TILE_DISPLAY_STATE_MINIMIZED) {
            UpdateTitle();
              }
        }