示例#1
0
        public void LoadPluginPanelView(SavedPluginView savedPluginView)
        {
            _accountInfo.SelectPanel();
            UserAllTweets pluginView = null;
            //PluginName and PluginStream are not unique. This is a bug. Once guids are implemented, only use guids with streamname.
            string plugin = "PLUGIN" + savedPluginView.PluginStream + savedPluginView.PluginId.ToString();
            if (_panelViewDict.ContainsKey(plugin))
            {
                pluginView = _panelViewDict[plugin];
            }
            else
            {
                //Plugin Impementation.
                List<KeyValuePair<TOBPluginInfo, Type>> pluginInfos = PluginManager.Current.GetPluginInfos();
                ITOBPlugin defaultPlugin;
                Type pluginType = pluginInfos.Where(kvpair => kvpair.Key.PluginGUID == savedPluginView.PluginId).FirstOrDefault().Value;

                if (pluginType == null)
                {
                    //NEEDS - Logging to TOBLogger and needs to contain more info on which plugin failed on which stream.
                    MessageBox.Show("The plugin corresponding to this view is either deleted or corrupted. You can also delete this SavePlugin View by pressing the delete button.");
                    return;
                }

                defaultPlugin = PluginManager.Current.GetPluginObject(pluginType);
                pluginView = new UserAllTweets(defaultPlugin);

                if (pluginView != null)
                {
                    PluginTypeEnum pluginStreamType = (PluginTypeEnum)savedPluginView.PluginStreamType;
                    TOBEntityEnum panelEnum = TOBEntityEnum.None;

                    switch (pluginStreamType)
                    {
                        case PluginTypeEnum.PanelType:
                            {
                                panelEnum = (TOBEntityEnum)Enum.Parse(typeof(TOBEntityEnum), savedPluginView.PluginStream, true);
                                break;
                            }
                        case PluginTypeEnum.SavedFilter:
                            {
                                string filterText = savedPluginView.PluginStream;
                                SavedFilter savedFilter = LocalSavedFilterBO.Get(sf => sf.FilterText == filterText);

                                if (savedFilter != null)
                                {
                                    panelEnum = (TOBEntityEnum)savedFilter.PanelTypeId;
                                    pluginView.InternalStringFilter = filterText;
                                }
                                break;
                            }
                        case PluginTypeEnum.SavedSearch:
                            {
                                //IMPLEMENTATION TO BE COMPLETED IN FUTURE
                                //List<Search> searchList = GetSearchList(savedPluginView.PluginStream);
                                //pluginView.SearchCollection = new SortableObservableCollection<Search>(searchList);
                                break;
                            }
                    }

                    if (panelEnum != TOBEntityEnum.None)
                    {
                        SetMessageObjectPanelCollection(pluginView, panelEnum, null);
                    }

                }
                _panelViewDict.Add(plugin, pluginView);
            }
            _currentTweetsView = pluginView;
            _mainWindow.frmTOBMain.Content = pluginView;
        }
示例#2
0
 public void DeletePlugin(SavedPluginView savedPluginView)
 {
     MessageBoxResult messageResult;
     messageResult = MessageBox.Show("Are you sure you want to delete this plugin stream?", "Delete Confirmation", MessageBoxButton.YesNo);
     if (messageResult == MessageBoxResult.Yes)
     {
         SavedPluginView savedPlugin = LocalSavedPluginViewBO.Get(pl => pl.Id == savedPluginView.Id);
         if (savedPlugin != null)
         {
           LocalSavedPluginViewBO.Delete(savedPlugin);
           LocalSavedPluginViewBO.SaveChanges();
         }
         string plugin = "PLUGIN" + savedPluginView.PluginStream + savedPluginView.PluginId.ToString();
         if (_panelViewDict.ContainsKey(plugin))
         {
             _panelViewDict.Remove(plugin);
         }
     }
     _accountInfo.BindPluginPanels();
     Panel info = null; //Need to change this
     LoadHomeView(info);
 }
示例#3
0
partial         void UpdateSavedPluginView(SavedPluginView instance);
示例#4
0
partial         void InsertSavedPluginView(SavedPluginView instance);
示例#5
0
partial         void DeleteSavedPluginView(SavedPluginView instance);
示例#6
0
        private void btnPluginSave_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                if (listBoxPlugin.SelectedIndex == -1)
                {
                    return;
                }
                TOBPluginInfo pluginInfos = listBoxPlugin.SelectedItem as TOBPluginInfo;
                SavedPluginView savedPluginView = new SavedPluginView();

                TOBEntityBase tob = cmbPluginStream.SelectedItem as TOBEntityBase;

                if (tob.GetType().Name == PluginTypeEnum.PanelType.ToString())
                {
                    savedPluginView.PluginStreamType = 0;
                }
                else if (tob.GetType().Name == PluginTypeEnum.SavedSearch.ToString())
                {
                    savedPluginView.PluginStreamType = 1;
                }
                else if (tob.GetType().Name == PluginTypeEnum.SavedFilter.ToString())
                {
                    savedPluginView.PluginStreamType = 2;
                }
                savedPluginView.PluginName = pluginInfos.PluginName;
                savedPluginView.PluginId = pluginInfos.PluginGUID;
                savedPluginView.PluginStream = cmbPluginStream.Text;
                LocalSavedPluginViewBO.Insert(savedPluginView);
                LocalSavedPluginViewBO.SaveChanges();

                PluginPopup.IsOpen = false;
                BindPluginPanels();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }