예제 #1
0
        /// <summary>
        /// 将控件转换为TabItem,便于显示到界面上
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        public FrameworkElement ToControl(DataViewPluginArgument arg)
        {
            SelectedDataChanged += arg.OnSelectedItemChanged;
            TabItem ti = new TabItem();

            if (!string.IsNullOrWhiteSpace(PluginInfo.Icon))      //设置了图标
            {
                try
                {
                    Image img = new Image();
                    img.Source  = new BitmapImage(new Uri(PluginInfo.Icon, UriKind.RelativeOrAbsolute));
                    img.Stretch = System.Windows.Media.Stretch.UniformToFill;
                    img.Width   = img.Height = 16;
                    img.ToolTip = PluginInfo.Name;
                    ti.Header   = img;
                }
                catch (Exception)
                {
                }
            }
            if (ti.Header == null)
            {
                ti.Header = PluginInfo.Name;
            }
            ti.Content = GetControl(arg);
            return(ti);
        }
예제 #2
0
        /// <summary>
        /// 选择了某个联系人,在右侧显示对话
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lsb1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataViewPluginArgument arg = lsb1.DataContext as DataViewPluginArgument;

            if (arg == null)
            {
                return;
            }
            WeChatFriendShow accout = lsb1.SelectedItem as WeChatFriendShow;
            TreeNode         nodes  = arg.CurrentData as TreeNode;

            if (accout == null || nodes == null)
            {
                return;
            }
            var selNode = nodes.TreeNodes.FirstOrDefault(t => t.Text == accout.Nick);   //获取选择的好友
            var views   = DataViewPluginAdapter.Instance.GetView(arg.DataSource.PluginInfo.Guid, selNode.Type, new DataViewConfigure()
            {
                IsDefaultGridViewVisibleWhenMultiviews = true
            });

            tbdetail.Items.Clear();
            foreach (var v in views)    //生成消息列表显示视图列表
            {
                v.SelectedDataChanged += OnSelectedDataChanged;
                tbdetail.Items.Add(v.ToControl(new DataViewPluginArgument()
                {
                    CurrentData = selNode, DataSource = arg.DataSource
                }));
            }
            tbdetail.SelectedIndex = tbdetail.HasItems ? 0 : -1;

            OnSelectedDataChanged?.Invoke(lsb1.SelectedValue);
        }
예제 #3
0
        public override FrameworkElement GetControl(DataViewPluginArgument arg)
        {
            PhoneLayoutControl grid = new PhoneLayoutControl();

            grid.DataContext = arg;
            return(grid);
        }
예제 #4
0
        public override FrameworkElement GetControl(DataViewPluginArgument arg)
        {
            DefaultGridViewControl grid = new DefaultGridViewControl();

            grid.DataContext            = arg;
            grid.OnSelectedDataChanged += OnSelectedDataChanged;
            return(grid);
        }
예제 #5
0
        public override FrameworkElement GetControl(DataViewPluginArgument arg)
        {
            var             plugin = PluginInfo as DataViewPluginInfo;
            HtmlViewControl ctrl   = new HtmlViewControl(plugin.ScriptObject, arg);

            ctrl.OnSelectedDataChanged += OnSelectedDataChanged;
            return(ctrl);
        }
        public override FrameworkElement GetControl(DataViewPluginArgument arg)
        {
            ContactMessageUserControl ctrl = new ContactMessageUserControl();

            ctrl.DataContext            = arg;
            ctrl.OnSelectedDataChanged += OnSelectedDataChanged;
            return(ctrl);
        }
예제 #7
0
        public HtmlViewControl(string url, DataViewPluginArgument source)
        {
            InitializeComponent();

            this.Url        = url; //@"C:\Users\fhjun\Desktop\htmp\323\index.html"
            this.DataSource = source;
            SaveDataSource();
            _operator.OnSelectedDataChanged += OnSelectedDataChanged;

            web1.Navigate(new Uri(this.Url, UriKind.RelativeOrAbsolute));
            web1.ObjectForScripting = _operator;
        }
예제 #8
0
 /// <summary>
 /// 获取显示的插件控件
 /// </summary>
 /// <param name="arg"></param>
 /// <returns></returns>
 public abstract FrameworkElement GetControl(DataViewPluginArgument arg);
예제 #9
0
        public DefaultLayoutViewControl(DataViewPluginArgument arg)
        {
            InitializeComponent();

            this.DataContext = new ViewModel.DefaultLayoutViewModel(arg);
        }
예제 #10
0
        public override FrameworkElement GetControl(DataViewPluginArgument arg)
        {
            DefaultLayoutViewControl grid = new DefaultLayoutViewControl(arg);

            return(grid);
        }