コード例 #1
0
ファイル: Plugin-Async.cs プロジェクト: iansuri/bthmsdevemul
        /// <summary>
        /// Called by the Remote Tools Framework at load-time for the plugin.
        /// You need to define the node structure and create your data objects here.
        /// </summary>
        protected override void OnInit()
        {
            // build data objects.
            ctrlPanelData = new ControlPanelData(this, guidTopLevelNode);
            ctrlPanelData.DeviceLoggingChanged += new LoggingChangedEventHandler(controlPanelData_DeviceLoggingChanged);
            ctrlPanelData.DesktopLoggingChanged += new LoggingChangedEventHandler(controlPanelData_DesktopLoggingChanged);
            ctrlPanelData.CommLoggingChanged += new LoggingChangedEventHandler(controlPanelData_CommLoggingChanged);            

            AddData(ctrlPanelData);

            // build view objects.
            ctrlPanelView = new ControlPanelView(ctrlPanelData);

            // If the plugin is running "standalone", that means that it does not need
            // to share the TreeView control in the shell with anyone else. It would
            // be redundant to add a top node to identify the plugin (the one with a
            // hammer and wrench).
            if (Standalone)
            {
                guidTopLevelNode = null;
            }
            else
            {
                // Otherwise... this plugin is sharing the TreeView with other plugins,
                // and therefore should add a top level node to idenifty the plugin.
                //
                // This will add a top level node by setting the guid for the parent to null.
                // There is no view panel associated with this node.
                topNode = new PluginNode(Title, guidTopLevelNode, null, ctrlPanelData, ctrlPanelView, this, BuiltInIcon.Custom);
                topNode.CustomIcon = Resources.bluetooth_regular;
                AddNode(topNode);                
            }

            // add "About" menu item.
            CommandUICommand cmdAbout = new CommandUICommand(CommandUI.CommandRoot.HelpMenu, Resources.About);
            cmdAbout.Clicked += new EventHandler(cmdAbout_Clicked);
            CommandUI.PluginCommands.Add(cmdAbout);

            OpenDevice();
        }
コード例 #2
0
 /// <summary>
 /// Construct a view. This object is created on the primary UI thread.
 /// </summary>
 /// <param name="data">Plugin data object</param>
 public ControlPanelView(ControlPanelData data) : base(data)
 {
     InitializeComponent();            
 }