示例#1
0
        /// <summary>
        /// Renders the specified chat node to the client.
        /// </summary>
        /// <param name="node">The node to append.</param>
        /// <remarks>
        /// <para>The return value of this function is a reference to the outermost <see cref="HtmlElement">HtmlElement</see> constructed
        /// by this function.  It may create additional inner elements as needed.</para>
        /// </remarks>
        /// <returns>
        /// Returns an object instance of <see cref="HtmlElement">HtmlElement</see> that can be appended to the HTML document.
        /// </returns>
        public override Inline Render(ChatNode node)
        {
            IIconProvider provider = ProfileResourceProvider.GetForClient(null).Icons;

            ImageChatNode icn = node as ImageChatNode;

            if (icn != null)
            {
                InlineUIContainer result = new InlineUIContainer();
                Image             img    = new Image();
                img.Source  = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap((icn.Image as System.Drawing.Bitmap).GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                img.ToolTip = icn.Text;
                img.Width   = provider.IconSize.Width;
                img.Height  = provider.IconSize.Height;

                result.Child = img;

                if (icn.LinkUri != null)
                {
                    Hyperlink container = new Hyperlink(result);
                    container.NavigateUri = node.LinkUri;
                    container.ToolTip     = string.Format(CultureInfo.CurrentUICulture, "Link to {0}", node.LinkUri);

                    return(container);
                }

                return(result);
            }
            else
            {
                return(base.Render(node));
            }
        }
        public AppShortcutsImplementation()
        {
            IsSupportedByCurrentPlatformVersion = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 2) && JumpList.IsSupported();

            _embeddedIconProvider = new EmbeddedIconProvider();
            _customIconProvider   = new CustomIconProvider();
        }
        public TailViewModelFactory([NotNull] IObjectProvider objectProvider,
            [NotNull] ISchedulerProvider schedulerProvider, 
            [NotNull] IColourProvider colourProvider,
            [NotNull] ISearchMetadataFactory searchMetadataFactory, 
            [NotNull] IIconProvider iconProvider,
            [NotNull] ITailViewStateControllerFactory tailViewStateControllerFactory,
            [NotNull] ITextAssociationCollection textAssociationCollection,
            [NotNull]  IThemeProvider themeProvider)
        {
            if (objectProvider == null) throw new ArgumentNullException(nameof(objectProvider));
            if (schedulerProvider == null) throw new ArgumentNullException(nameof(schedulerProvider));
            if (colourProvider == null) throw new ArgumentNullException(nameof(colourProvider));
            if (searchMetadataFactory == null) throw new ArgumentNullException(nameof(searchMetadataFactory));
            if (iconProvider == null) throw new ArgumentNullException(nameof(iconProvider));
            if (tailViewStateControllerFactory == null)
                throw new ArgumentNullException(nameof(tailViewStateControllerFactory));

            _objectProvider = objectProvider;
            _schedulerProvider = schedulerProvider;
            _colourProvider = colourProvider;
            _searchMetadataFactory = searchMetadataFactory;
            _iconProvider = iconProvider;
            _tailViewStateControllerFactory = tailViewStateControllerFactory;
            _textAssociationCollection = textAssociationCollection;
            _themeProvider = themeProvider;
        }
示例#4
0
        public IconSelector([NotNull] IIconProvider iconsProvider, [NotNull] ISchedulerProvider schedulerProvider)
        {
            if (iconsProvider == null)
            {
                throw new ArgumentNullException(nameof(iconsProvider));
            }
            if (schedulerProvider == null)
            {
                throw new ArgumentNullException(nameof(schedulerProvider));
            }

            //build a predicate when SearchText changes
            var filter = this.WhenValueChanged(t => t.SearchText)
                         .Throttle(TimeSpan.FromMilliseconds(250))
                         .Select(BuildFilter);

            var userOptions = iconsProvider.Icons.Connect()
                              .Filter(filter)
                              .Sort(SortExpressionComparer <IconDescription> .Ascending(icon => icon.Name))
                              .ObserveOn(schedulerProvider.MainThread)
                              .Bind(out var icons)
                              .Subscribe();

            HasSelection = this.WhenValueChanged(vm => vm.Selected)
                           .Select(selected => selected != null)
                           .ForBinding();

            Icons = icons;

            _cleanUp = new CompositeDisposable(userOptions);
        }
示例#5
0
 internal TextSearcherViewModel(ITextSearcher textSearcher)
 {
     mTextSearcher = textSearcher;
     mTextSearcherAsCaptionProvider     = textSearcher as ICaptionProvider;
     mTextSearcherAsDescriptionProvider = textSearcher as IDescriptionProvider;
     mTextSearcherAsIconProvider        = textSearcher as IIconProvider;
 }
                public CollectionItemView(IIconProvider iconProvider, IHostResourceProvider hostResources)
                {
                    Identifier         = CollectionItemId;
                    this.iconProvider  = iconProvider;
                    this.hostResources = hostResources;

                    AddSubview(this.label);
                    if (iconProvider != null)
                    {
                        AddSubview(this.iconView);
                        AddConstraints(new[] {
                            NSLayoutConstraint.Create(this.iconView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1, 7),
                            NSLayoutConstraint.Create(this.iconView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1, 0),
                            NSLayoutConstraint.Create(this.iconView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 16),
                            NSLayoutConstraint.Create(this.iconView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1, 16),

                            NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this.iconView, NSLayoutAttribute.Trailing, 1, 0),
                        });
                    }
                    else
                    {
                        AddConstraint(NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1, 7));
                    }

                    AddConstraints(new[] {
                        NSLayoutConstraint.Create(this.label, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1, 0),
                        NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, 0)
                    });

                    ViewDidChangeEffectiveAppearance();
                }
示例#7
0
        public override Image GetImage(IIconProvider iconProvider)
        {
            if (_databaseEntity != null && BasicActivator.FavouritesProvider.IsFavourite(_databaseEntity))
            {
                return(CatalogueIcons.StarHollow);
            }

            return(iconProvider.GetImage(RDMPConcept.Favourite, OverlayKind.Add));
        }
示例#8
0
        public override Image GetImage(IIconProvider iconProvider)
        {
            if (_o == null)
            {
                return(null);
            }

            return(iconProvider.GetImage(_o, OverlayKind.Edit));
        }
        public ClanListBoxItemRenderer()
        {
            ProfileResourceProvider prp = ProfileResourceProvider.GetForClient(null);

            if (!object.ReferenceEquals(prp, null))
            {
                m_provider = prp.Icons;
            }
        }
        public AppShortcutsImplementation()
        {
            _embeddedIconProvider = new EmbeddedIconProvider();
            _customIconProvider   = new CustomIconProvider();
            _manager = (ShortcutManager)Application.Context.GetSystemService(Context.ShortcutService);

            _isShortcutsSupported = Build.VERSION.SdkInt >= BuildVersionCodes.NMr1;

            Init();
        }
        public override Image GetImage(IIconProvider iconProvider)
        {
            if (_patcher != null)
            {
                var basicIcon = _databaseIconProvider.GetIconForAssembly(_patcher.GetDbAssembly());
                return(_overlayProvider.GetOverlay(basicIcon, OverlayKind.Add));
            }

            return(iconProvider.GetImage(RDMPConcept.ExternalDatabaseServer, OverlayKind.Add));
        }
示例#12
0
        public override Image GetImage(IIconProvider iconProvider)
        {
            //if we know the cic the context is 'pick a project'
            if (_cic != null)
            {
                return(iconProvider.GetImage(RDMPConcept.Project, OverlayKind.Add));
            }

            //if we know the _project the context is 'pick a cic'  (or if we don't know either then just use this icon too)
            return(iconProvider.GetImage(RDMPConcept.CohortIdentificationConfiguration, OverlayKind.Link));
        }
 /// <summary>
 /// Disposes the object, cleaning up unmanaged and optionally managed resources.
 /// </summary>
 /// <param name="disposing">Whether to dispose managed resources.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (m_iconProvider != null)
         {
             m_iconProvider.Dispose();
             m_iconProvider = null;
         }
     }
 }
示例#14
0
        public AtomicCommandLinkLabel(IIconProvider iconProvider, IAtomicCommand command)
        {
            _command = command;
            InitializeComponent();

            pbCommandIcon.Image = command.GetImage(iconProvider);
            var name = command.GetCommandName();

            lblName.Text = name;

            helpIcon1.SetHelpText(_command.GetCommandName(), command.GetCommandHelp());
        }
 public TailViewModelFactory(IObjectProvider objectProvider,
                             ISchedulerProvider schedulerProvider,
                             IColourProvider colourProvider,
                             ISearchMetadataFactory searchMetadataFactory,
                             IIconProvider iconProvider)
 {
     _objectProvider        = objectProvider;
     _schedulerProvider     = schedulerProvider;
     _colourProvider        = colourProvider;
     _searchMetadataFactory = searchMetadataFactory;
     _iconProvider          = iconProvider;
 }
        ///<summary>
        /// Default constructor for FerdaToolBar class.
        ///</summary>
        public FerdaToolBar(ILocalizationManager lockManager, IIconProvider provider, 
            Menu.FerdaMenu menu)
            : base()
        {
            this.iconProvider = provider;
            this.menu = menu;

            localizationManager = lockManager;
            ResManager = localizationManager.ResManager;

            SetupFile();
            SetupOther();
        }
示例#17
0
        public override Image GetImage(IIconProvider iconProvider)
        {
            switch (_operation)
            {
            case SetOperation.EXCEPT: return(iconProvider.GetImage(CatalogueIcons.EXCEPT));

            case SetOperation.INTERSECT: return(iconProvider.GetImage(CatalogueIcons.INTERSECT));

            case SetOperation.UNION: return(iconProvider.GetImage(CatalogueIcons.UNION));
            }

            return(base.GetImage(iconProvider));
        }
示例#18
0
 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     if (values.Length == 2)
     {
         IIconProvider iconProvider = values[0] as IIconProvider;
         object        key          = values[1];
         if (iconProvider != null && key != null)
         {
             return((object)iconProvider.GetIconAsImageSource(key, parameter));
         }
     }
     return((object)null);
 }
示例#19
0
 public SearchProxyCollectionFactory([NotNull] ISearchMetadataFactory searchMetadataFactory,
                                     [NotNull] ISchedulerProvider schedulerProvider,
                                     [NotNull] IColourProvider colourProvider,
                                     [NotNull] IIconProvider iconsProvider,
                                     [NotNull] ITextAssociationCollection textAssociationCollection,
                                     [NotNull] IThemeProvider themeProvider)
 {
     SearchMetadataFactory     = searchMetadataFactory ?? throw new ArgumentNullException(nameof(searchMetadataFactory));
     SchedulerProvider         = schedulerProvider ?? throw new ArgumentNullException(nameof(schedulerProvider));
     ColourProvider            = colourProvider ?? throw new ArgumentNullException(nameof(colourProvider));
     IconsProvider             = iconsProvider ?? throw new ArgumentNullException(nameof(iconsProvider));
     TextAssociationCollection = textAssociationCollection ?? throw new ArgumentNullException(nameof(textAssociationCollection));
     ThemeProvider             = themeProvider ?? throw new ArgumentNullException(nameof(themeProvider));
 }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length == 2)
            {
                IIconProvider iconProvider   = values[0] as IIconProvider;
                object        objectToLookUp = values[1];
                if (iconProvider != null && objectToLookUp != null)
                {
                    return(iconProvider.GetIconAsImageSource(objectToLookUp, parameter));
                }
            }

            return(null);
        }
示例#21
0
 public OpenWithApp(
     IConfigProvider configProvider,
     IDialogService dialogService,
     IFilterFactory filterFactory,
     IProcessStarter processStarter,
     IIconProvider iconProvider
     )
 {
     _configProvider = configProvider;
     _dialogService  = dialogService;
     _filterFactory  = filterFactory;
     _processStarter = processStarter;
     _iconProvider   = iconProvider;
 }
            private static void InitializeDictionary()
            {
                JinxBotConfiguration config = JinxBotConfiguration.Instance;

                foreach (var element in config.Globals.IconProviders)
                {
                    Type type = Type.GetType(element.TypeName);
                    if (type != null && typeof(IIconProvider).IsAssignableFrom(type))
                    {
                        IIconProvider provider = Activator.CreateInstance(type) as IIconProvider;
                        s_existingProviders.Add(element.Name, provider);
                    }
                }
            }
示例#23
0
        /// <summary>
        /// Registers an <see cref="IIconProvider"/> with the static <see cref="IconProvider"/> class.
        /// </summary>
        /// <param name="iconProvider">The <see cref="IIconProvider"/> to register.</param>
        /// <exception cref="ArgumentNullException"><paramref name="iconProvider"/> is null.</exception>
        public static void Register(IIconProvider iconProvider)
        {
            if (iconProvider is null)
            {
                throw new ArgumentNullException(nameof(iconProvider));
            }

            var conflicting = _iconProvidersByPrefix.Values.FirstOrDefault(existing => IsPrefix(existing.Prefix, iconProvider.Prefix));

            if (conflicting != null)
            {
                throw new ArgumentException($"Prefix \"{iconProvider.Prefix}\" conflicts with existing icon provider prefix \"{conflicting.Prefix}\".");
            }

            _iconProvidersByPrefix.Add(iconProvider.Prefix, iconProvider);
        }
        public TailViewModelFactory([NotNull] IObjectProvider objectProvider,
                                    [NotNull] ISchedulerProvider schedulerProvider,
                                    [NotNull] IColourProvider colourProvider,
                                    [NotNull] ISearchMetadataFactory searchMetadataFactory,
                                    [NotNull] IIconProvider iconProvider,
                                    [NotNull] ITailViewStateControllerFactory tailViewStateControllerFactory,
                                    [NotNull] ITextAssociationCollection textAssociationCollection,
                                    [NotNull]  IThemeProvider themeProvider)
        {
            if (objectProvider == null)
            {
                throw new ArgumentNullException(nameof(objectProvider));
            }
            if (schedulerProvider == null)
            {
                throw new ArgumentNullException(nameof(schedulerProvider));
            }
            if (colourProvider == null)
            {
                throw new ArgumentNullException(nameof(colourProvider));
            }
            if (searchMetadataFactory == null)
            {
                throw new ArgumentNullException(nameof(searchMetadataFactory));
            }
            if (iconProvider == null)
            {
                throw new ArgumentNullException(nameof(iconProvider));
            }
            if (tailViewStateControllerFactory == null)
            {
                throw new ArgumentNullException(nameof(tailViewStateControllerFactory));
            }

            _objectProvider                 = objectProvider;
            _schedulerProvider              = schedulerProvider;
            _colourProvider                 = colourProvider;
            _searchMetadataFactory          = searchMetadataFactory;
            _iconProvider                   = iconProvider;
            _tailViewStateControllerFactory = tailViewStateControllerFactory;
            _textAssociationCollection      = textAssociationCollection;
            _themeProvider                  = themeProvider;
        }
示例#25
0
        internal ChannelListBoxItemRenderer()
        {
            ProfileResourceProvider prp = ProfileResourceProvider.GetForClient(null);
            if (!object.ReferenceEquals(prp, null))
                m_provider = prp.Icons;

            m_pingImg = new Bitmap(28, 14);
            Rectangle bounds = new Rectangle(0, 0, 28, 14);
            using (Graphics g = Graphics.FromImage(m_pingImg))
            using (LinearGradientBrush b = new LinearGradientBrush(bounds, Color.Black, Color.Black, 0, false))
            {
                ColorBlend cb = new ColorBlend();
                cb.Colors = new Color[] { Color.LimeGreen, Color.Lime, Color.Yellow, Color.Orange, Color.OrangeRed, Color.Maroon };
                cb.Positions = new float[] { 0f, 0.1f, 0.4f, 0.6f, 0.9f, 1f };
                b.InterpolationColors = cb;

                g.FillRectangle(b, bounds);
            }
        }
        /// <summary>
        /// Default constructor for the class
        /// </summary>
        /// <param name="locManager">Interface that takes care of the localization</param>
        /// <param name="menuDisp">Menu displayer</param>
        /// <param name="modManager">Modules Manager</param>
        /// <param name="iconProvider">Provider of the icons</param>
        /// <param name="toolBar">ToolBar of the application</param>
        public NewBoxControl(Menu.ILocalizationManager locManager,
            Menu.IMenuDisplayer menuDisp, ModulesManager.ModulesManager modManager,
            IIconProvider iconProvider, Menu.IMenuDisplayer toolBar)
        {
            treeView = new NewBoxTreeView(locManager, menuDisp, modManager, iconProvider, toolBar);
            treeView.WidthConstant = this.heightConstant;
            treeView.BorderStyle = BorderStyle.FixedSingle;
            textBox = new RichTextBox();
            treeView.TextBox = textBox;
            textBox.BorderStyle = BorderStyle.Fixed3D;
            textBox.ReadOnly = true;
            this.Controls.Add(textBox);
            this.Controls.Add(treeView);

            //InitializeComponent things
            this.Name = "FerdaArchive";
            this.Size = new System.Drawing.Size(170, 500);
            this.ResumeLayout(false);
            this.PerformLayout();
        }
示例#27
0
        /// <summary>
        /// Gets the SVG path of the icon associated with the specified value using the registered icon providers.
        /// </summary>
        /// <param name="value">The value specifying the icon to return it's path from.</param>
        /// <returns>If <paramref name="value"/> is not <c>null</c> or empty the path of the icon; otherwise <c>string.Empty</c>.</returns>
        /// <exception cref="KeyNotFoundException">No provider with prefix matching <paramref name="value"/> found.</exception>
        /// <exception cref="KeyNotFoundException">No icon associated
        /// with the specified <paramref name="value"/> found.</exception>
        public static string GetIconPath(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(string.Empty);
            }

            IIconProvider provider = _iconProvidersByPrefix
                                     .Select(prefixProviderPair => prefixProviderPair.Value)
                                     .FirstOrDefault(provider => value.StartsWith(provider.Prefix, StringComparison.OrdinalIgnoreCase));

            if (provider is null)
            {
                throw new KeyNotFoundException($"No provider with prefix matching \"{value}\" found.");
            }
            else
            {
                return(provider.GetIconPath(value));
            }
        }
        public int CompareTo(IIconProvider other)
        {
            if (other.Style == null)
            {
                return(1);
            }
            if (Style == null)
            {
                return(-1);
            }

            if (Style.Layer != other.Style.Layer)
            {
                if (Style.Layer <= other.Style.Layer)
                {
                    return(-1);
                }
                return(1);
            }
            return(0);
        }
示例#29
0
        public AtomicCommandWithTargetUI(IIconProvider iconProvider, IAtomicCommandWithTarget command, IEnumerable <T> selection, Func <T, string> propertySelector)
        {
            _command = command;
            InitializeComponent();

            _selection = selection.ToArray();

            pbCommandIcon.Image       = command.GetImage(iconProvider);
            helpIcon1.BackgroundImage = iconProvider.GetImage(RDMPConcept.Help);

            string name = command.GetCommandName();

            lblName.Text = name;

            helpIcon1.SetHelpText(_command.GetCommandName(), _command.GetCommandHelp());

            selectIMapsDirectlyToDatabaseTableComboBox1.SetUp(_selection.Cast <IMapsDirectlyToDatabaseTable>().ToArray());
            selectIMapsDirectlyToDatabaseTableComboBox1.SelectedItemChanged += suggestComboBox1_SelectedIndexChanged;
            lblGo.Enabled = false;

            Enabled = _selection.Any();
        }
示例#30
0
        internal ChannelListBoxItemRenderer()
        {
            ProfileResourceProvider prp = ProfileResourceProvider.GetForClient(null);

            if (!object.ReferenceEquals(prp, null))
            {
                m_provider = prp.Icons;
            }

            m_pingImg = new Bitmap(28, 14);
            Rectangle bounds = new Rectangle(0, 0, 28, 14);

            using (Graphics g = Graphics.FromImage(m_pingImg))
                using (LinearGradientBrush b = new LinearGradientBrush(bounds, Color.Black, Color.Black, 0, false))
                {
                    ColorBlend cb = new ColorBlend();
                    cb.Colors             = new Color[] { Color.LimeGreen, Color.Lime, Color.Yellow, Color.Orange, Color.OrangeRed, Color.Maroon };
                    cb.Positions          = new float[] { 0f, 0.1f, 0.4f, 0.6f, 0.9f, 1f };
                    b.InterpolationColors = cb;

                    g.FillRectangle(b, bounds);
                }
        }
示例#31
0
        public SearchProxyCollection(ISearchMetadataCollection metadataCollection,
            Guid id,
            Action<SearchMetadata> changeScopeAction,
            ISchedulerProvider schedulerProvider,
            IColourProvider colourProvider,
            IIconProvider iconsProvider,
            ITextAssociationCollection textAssociationCollection,
            IThemeProvider themeProvider)
        {
            var proxyItems = metadataCollection.Metadata.Connect()
                .WhereReasonsAre(ChangeReason.Add, ChangeReason.Remove) //ignore updates because we update from here
                .Transform(meta =>
                {
                    return new SearchOptionsProxy(meta,
                        changeScopeAction,
                        colourProvider,
                        themeProvider,
                        new IconSelector(iconsProvider, schedulerProvider),
                        m => metadataCollection.Remove(m.SearchText),
                        iconsProvider.DefaultIconSelector,
                        id);
                })
                .SubscribeMany(so =>
                {
                    //when a value changes, write the original value back to the metadata collection
                    var anyPropertyHasChanged = so.WhenAnyPropertyChanged()
                        .Select(_ => (SearchMetadata) so)
                        .Subscribe(metadataCollection.AddorUpdate);

                    //when an icon or colour has changed we need to record user choice so
                    //the same choice can be used again
                    var iconChanged = so.WhenValueChanged(proxy => proxy.IconKind, false).ToUnit();
                    var colourChanged = so.WhenValueChanged(proxy => proxy.HighlightHue, false).ToUnit();
                    var ignoreCaseChanged = so.WhenValueChanged(proxy => proxy.CaseSensitive, false).ToUnit();

                    var textAssociationChanged = iconChanged.Merge(colourChanged).Merge(ignoreCaseChanged)
                        .Throttle(TimeSpan.FromMilliseconds(250))
                        .Select(_ => new TextAssociation(so.Text, so.CaseSensitive, so.UseRegex, so.HighlightHue.Swatch,
                            so.IconKind.ToString(), so.HighlightHue.Name, DateTime.UtcNow))
                        .Subscribe(textAssociationCollection.MarkAsChanged);

                    return new CompositeDisposable(anyPropertyHasChanged, textAssociationChanged);
                })
                .AsObservableCache();

            Count = proxyItems.CountChanged.StartWith(0).ForBinding();

            var monitor = MonitorPositionalChanges().Subscribe(metadataCollection.Add);

            //load data onto grid
            var collection = new ObservableCollectionExtended<SearchOptionsProxy>();

            var includedLoader = proxyItems
                .Connect(proxy => !proxy.IsExclusion)
                .Sort(SortExpressionComparer<SearchOptionsProxy>.Ascending(proxy => proxy.Position))
                .ObserveOn(schedulerProvider.MainThread)
                //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                .Bind(collection, new ObservableCollectionAdaptor<SearchOptionsProxy, string>(0))
                .DisposeMany()
                .Subscribe();

            ReadOnlyObservableCollection<SearchOptionsProxy> excluded;
            var excludedLoader = proxyItems
                .Connect(proxy => proxy.IsExclusion)
                .Sort(SortExpressionComparer<SearchOptionsProxy>.Ascending(proxy => proxy.Text))
                .ObserveOn(schedulerProvider.MainThread)
                //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                .Bind(out excluded)
                .DisposeMany()
                .Subscribe();

            Excluded = excluded;
            Included = new ReadOnlyObservableCollection<SearchOptionsProxy>(collection);

            _cleanUp = new CompositeDisposable(proxyItems, includedLoader, excludedLoader, monitor);
        }
        ///<summary>
        /// Default constructor for FerdaArchive class. Initializes all menu controls
        /// and adds them to the menu.
        ///</summary>
        public FerdaMenu(
            IDockingManager dockManager, ILocalizationManager lockManager,
            ProjectManager.ProjectManager pm, IControlsManager contMan,
            IIconProvider provider)
            : base()
        {
            //setting the iconProvider
            iconProvider = provider;

            //filling the private fields
            dockingManager = dockManager;
            localizationManager = lockManager;
            ResManager = localizationManager.ResManager;
            projectManager = pm;
            controlsManager = contMan;

            //adding the main group of the menu
            SetupMainMenuGroup();

            //adding the file group of the menu
            SetupFile();

            //adding the edit group of the menu
            SetupEdit();

            //adding the view group of the menu
            SetupView();

            //SetupDesktop();

            //adding the actions group of the menu, will be done dynamically
            //probably calling some function

            SetupTools();
            SetupHelp();
        }
        public SearchOptionsViewModel(ISearchMetadataCollection metadataCollection,
            ISearchMetadataFactory searchMetadataFactory,
            ISchedulerProvider schedulerProvider,
            IColourProvider colourProvider,
            IIconProvider iconsProvider,
            ITextAssociationCollection textAssociationCollection,
            SearchHints searchHints,
            IThemeProvider themeProvider)
        {
            SearchHints = searchHints;

            var proxyItems = metadataCollection.Metadata.Connect()
                .WhereReasonsAre(ChangeReason.Add, ChangeReason.Remove) //ignore updates because we update from here
                .Transform(meta =>
                {
                    return new SearchOptionsProxy(meta,
                        colourProvider,
                        themeProvider,
                        new IconSelector(iconsProvider, schedulerProvider),
                        m => metadataCollection.Remove(m.SearchText),
                        iconsProvider.DefaultIconSelector,
                        Id);
                })
                .SubscribeMany(so =>
                {
                    //when a value changes, write the original value back to the metadata collection
                    var anyPropertyHasChanged = so.WhenAnyPropertyChanged()
                        .Select(_ => (SearchMetadata) so)
                        .Subscribe(metadataCollection.AddorUpdate);

                    //when an icon or colour has changed we need to record user choice so
                    //the same choice can be used again
                    var iconChanged = so.WhenValueChanged(proxy => proxy.IconKind,false).ToUnit();
                    var colourChanged = so.WhenValueChanged(proxy => proxy.HighlightHue, false).ToUnit();
                    var ignoreCaseChanged = so.WhenValueChanged(proxy => proxy.IgnoreCase, false).ToUnit();

                    var textAssociationChanged = iconChanged.Merge(colourChanged).Merge(ignoreCaseChanged)
                                .Throttle(TimeSpan.FromMilliseconds(250))
                                .Select(_=> new TextAssociation(so.Text, so.IgnoreCase, so.UseRegex, so.HighlightHue.Swatch, so.IconKind.ToString(), so.HighlightHue.Name, DateTime.Now))
                                .Subscribe(textAssociationCollection.MarkAsChanged);

                    return new CompositeDisposable(anyPropertyHasChanged, textAssociationChanged);
                })
                .AsObservableCache();

            var monitor = MonitorPositionalChanges()
                .Subscribe(metadataCollection.Add);

            //load data onto grid
            var collection = new ObservableCollectionExtended<SearchOptionsProxy>();

            var userOptions = proxyItems.Connect()
                .Sort(SortExpressionComparer<SearchOptionsProxy>.Ascending(proxy => proxy.Position))
                .ObserveOn(schedulerProvider.MainThread)
                //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                .Bind(collection, new ObservableCollectionAdaptor<SearchOptionsProxy, string>(0))
                .DisposeMany()
                .Subscribe();

            Data = new ReadOnlyObservableCollection<SearchOptionsProxy>(collection);

            //command to add the current search to the tail collection
            var searchInvoker = SearchHints.SearchRequested
                .ObserveOn(schedulerProvider.Background)
                .Subscribe(request =>
                {
                    var meta = searchMetadataFactory.Create(request.Text,
                        request.UseRegEx,
                        metadataCollection.NextIndex(),
                        false);
                    metadataCollection.AddorUpdate(meta);
                });

            _cleanUp = new CompositeDisposable(searchInvoker,
                userOptions,
                searchInvoker,
                monitor,
                SearchHints);
        }
 public override Image GetImage(IIconProvider iconProvider)
 {
     return(iconProvider.GetImage(RDMPConcept.ExtractionConfiguration, OverlayKind.Execute));
 }
        /// <summary>
        /// Fills the static fields of context menu for the node
        /// </summary>
        /// <param name="cMenu">Context menu of the TreeNode</param>
        /// <param name="provider">Interface that provides icons for the boxes</param>
        protected void SetStaticContextMenu(ContextMenuStrip cMenu, IIconProvider provider)
        {
            //handling normal items
            ToolStripMenuItem rename =
                new ToolStripMenuItem(ParentTreeView.ResManager.GetString("MenuEditRename"));
            ToolStripMenuItem copy =
                new ToolStripMenuItem(ParentTreeView.ResManager.GetString("MenuEditCopy"));
            ToolStripMenuItem clone =
                new ToolStripMenuItem(ParentTreeView.ResManager.GetString("MenuEditClone"));

            copy.Click += new EventHandler(copy_Click);
            rename.Click += new EventHandler(rename_Click);
            clone.Click += new EventHandler(clone_Click);

            //shortcuts
            rename.ShortcutKeys = Keys.F2;
            copy.ShortcutKeys = (Keys)Shortcut.CtrlC;
            clone.ShortcutKeys = (Keys)Shortcut.CtrlE;

            //icons
            rename.Image = provider.GetIcon("Rename").ToBitmap();
            copy.Image = provider.GetIcon("Copy").ToBitmap();
            clone.Image = provider.GetIcon("Clone").ToBitmap();

            cMenu.Items.AddRange(new ToolStripItem[] {rename, copy, clone });

            if (!ParentTreeView.Clipboard.IsEmpty)
            {
                ToolStripMenuItem paste =
                    new ToolStripMenuItem(ParentTreeView.ResManager.GetString("MenuEditPaste"));
                paste.Click += new EventHandler(paste_Click);
                paste.ShortcutKeys = (Keys)Shortcut.CtrlV;
                paste.Image = provider.GetIcon("Paste").ToBitmap();
                cMenu.Items.Add(paste);
            }

            ToolStripSeparator sep = new ToolStripSeparator();
            ToolStripMenuItem delete =
                new ToolStripMenuItem(ParentTreeView.ResManager.GetString("MenuArchiveDelete"));
            delete.Click += new EventHandler(delete_Click);
            delete.ShortcutKeys = (Keys)Shortcut.ShiftDel;
            delete.Image = provider.GetIcon("DeleteFromArchive").ToBitmap();
            cMenu.Items.AddRange(new ToolStripItem[] { sep, delete });
        }
        /// <summary>
        /// Constructor that sets the Box property
        /// </summary>
        /// <param name="box">box that will be represented by this node</param>
        /// <param name="alongDirection">the direction of expanding</param>
        /// <param name="arch">Archive where this box belongs</param>
        /// <param name="parent">Parent component of the archive</param>
        /// <param name="iconDictionary">Icon dictionary containing all the icons
        /// for the box visualization</param>
        /// <param name="list">Some image list</param>
        /// <param name="provider">Control providing access to all the icons</param>
        /// <param name="projManager">Project manager of the application</param>
        public FerdaTreeNode(ModulesManager.IBoxModule box, bool alongDirection, 
            ProjectManager.Archive arch, FerdaArchive parent, Dictionary<string, int> iconDictionary,
            ImageList list, IIconProvider provider, ProjectManager.ProjectManager projManager)
            : base()
        {
            Box = box;
            Text = box.UserName;
            AlongDirection = alongDirection;
            Archive = arch;
            ParentTreeView = parent;

            //icon provider for the menu
            this.provider = provider;

            //setting the projectManager
            projectManager = projManager;

            //setting the icon
            if (box.MadeInCreator.Icon.Length == 0)
            {
                this.ImageIndex = iconDictionary["naIcon"];
                this.SelectedImageIndex = iconDictionary["naIcon"];
            }
            else
            {
                string label = box.MadeInCreator.Label;

                if (iconDictionary.ContainsKey(label))
                {
                    this.ImageIndex = iconDictionary[label];
                    this.SelectedImageIndex = iconDictionary[label];
                }
                else
                {
                    MemoryStream stream = new MemoryStream(box.MadeInCreator.Icon);
                    Icon icon = new Icon(stream);
                    int count = list.Images.Count;
                    list.Images.Add(icon);
                    iconDictionary.Add(label, count);

                    this.ImageIndex = count;
                    this.SelectedImageIndex = count;
                }
            }

            //sets the child nodes for this node
            if (AlongDirection)
            {
                //sets the boxes as ConnectionTo
                foreach(ModulesManager.IBoxModule b in Archive.ConnectedTo(Box))
                {
                    Nodes.Add(new FerdaTreeNode(b, AlongDirection, Archive,
                        ParentTreeView, iconDictionary, list, provider, projectManager));
                }
            }
            else
            {
                //sets the boxes as ConnectionFrom
                foreach(ModulesManager.IBoxModule b in Archive.ConnectionsFrom(Box))
                {
                    Nodes.Add(new FerdaTreeNode(b, AlongDirection, Archive,
                        ParentTreeView, iconDictionary, list, provider, projectManager));
                }
            }
        }
        ///<summary>
        /// Default constructor for FerdaView class.
        ///</summary>
        ///<param name="locManager">
        /// Interface that takes care of the 
        ///localizacion in the application
        /// </param>
        ///<param name="svgMan">
        /// Interface for providing SVG graphics
        ///</param>
        ///<param name="menuDisp">Menu displayer</param>
        ///<param name="view">The view thath should be connected to this desktop</param>
        ///<param name="pm">The project manager of the application</param>
        ///<param name="arch">Control that displays the archive</param>
        ///<param name="provider">Provider of the icons</param>
        ///<param name="toolBar">Toolbar control</param>
        public FerdaDesktop(Menu.ILocalizationManager locManager,
            SVGManager svgMan, IMenuDisplayer menuDisp, ProjectManager.View view,
            ProjectManager.ProjectManager pm, Archive.IArchiveDisplayer arch,
            IIconProvider provider, IMenuDisplayer toolBar)
            : base()
        {
            //setting the icon
            this.provider = provider;

            //adding the localization
            localizationManager = locManager;
            ResManager = localizationManager.ResManager;

            //adding the svgManager
            svgManager = svgMan;

            //setting the menu displayer
            menuDisplayer = menuDisp;
            archiveDisplayer = arch;
            this.toolBar = toolBar;

            //Current view
            this.view = view;
            projectManager = pm;

            //name of the desktop
            Name = view.Name;

            //properties od the GraphControl to work propertly
            AllowMoveShape = true;
            AllowAddConnection = true;
            AllowAddShape = true;
            AllowDeleteShape = true;
            AllowDrop = true;
            AutoScroll = true;
            EnableContextMenu = true;
            EnableLayout = false;
            ShowGrid = false;
            Zoom = 1;
            RestrictToCanvas = false;
            this.ImeMode = System.Windows.Forms.ImeMode.On;

            //for now trial stuff
            BackgroundType = Netron.GraphLib.CanvasBackgroundTypes.Gradient;
            GradientTop = System.Drawing.Color.SkyBlue;

            //EventHandlers
            GotFocus += new EventHandler(FerdaDesktop_GotFocus);
            OnContextMenu += new MouseEventHandler(FerdaDesktop_ContextMenu);
            OnNewConnection += new NewConnection(FerdaDesktop_OnNewConnection);
            KeyPress += new KeyPressEventHandler(FerdaDesktop_KeyPress);
            OnFerdaMouseUp += new MouseEventHandler(FerdaDesktop_OnFerdaMouseUp);
            OnFerdaDeleteConnection += new FerdaConnection(FerdaDesktop_OnFerdaDeleteConnection);
            OnShapeRemoved += new NewShape(FerdaDesktop_OnShapeRemoved);

            //Setting the arrow for connections
            DefaultLineEnd = ConnectionEnds.RightFilledArrow;

            //Creation of the boxes and connections
            Adapt();
        }
        ///<summary>
        /// Default constructor for FerdaArchive class.
        ///</summary>
        public FerdaArchive(Menu.ILocalizationManager locManager,
            Menu.IMenuDisplayer menuDisp, IFerdaClipboard clipboard,
            ProjectManager.Archive arch, IIconProvider iconProvider,
            Menu.IMenuDisplayer toolBar,
            ProjectManager.ProjectManager projManager)
            : base()
        {
            //setting the icon
            naIcon = iconProvider.GetIcon("NAIcon");
            this.iconProvider = iconProvider;

            //setting the localization
            localizationManager = locManager;
            ResManager = localizationManager.ResManager;

            //setting the menu displayer
            menuDisplayer = menuDisp;
            this.toolBar = toolBar;

            //setting the archive
            Archive = arch;

            //setting the projectManager
            projectManager = projManager;

            InitializeComponent();

            //Setting the texts of the radiobuttons
            RBAlong.Text = ResManager.GetString("ArchiveAlongText");
            RBAgainst.Text = ResManager.GetString("ArchiveAgainstText");
            RBAlong.Checked = true;

            //Setting the clipboard
            this.Clipboard = clipboard;

            //events
            GotFocus += new EventHandler(FerdaArchive_GotFocus);
            TVArchive.GotFocus += new EventHandler(FerdaArchive_GotFocus);
            TVArchive.MouseDown += new MouseEventHandler(TVArchive_MouseDown);
            TVArchive.MouseMove += new MouseEventHandler(TVArchive_MouseMove);

            //the labelEdit property
            TVArchive.LabelEdit = true;
            TVArchive.AfterLabelEdit += new NodeLabelEditEventHandler(TVArchive_AfterLabelEdit);

            CBCategories.SelectedIndexChanged += new EventHandler(CBArchive_SelectedIndexChanged);
            CBTypes.SelectedIndexChanged += new EventHandler(CBTypes_SelectedIndexChanged);
            RBAlong.CheckedChanged += new EventHandler(RBAlong_CheckedChanged);
            TVArchive.AfterSelect += new TreeViewEventHandler(TVArchive_AfterSelect);

            ArchiveSetupAfterLoadProject();
        }
示例#39
0
 /// <summary>
 /// Disposes the object, cleaning up unmanaged and optionally managed resources.
 /// </summary>
 /// <param name="disposing">Whether to dispose managed resources.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (m_iconProvider != null)
         {
             m_iconProvider.Dispose();
             m_iconProvider = null;
         }
     }
 }
 public override Image GetImage(IIconProvider iconProvider)
 {
     return(FamFamFamIcons.page_white_get);
 }
示例#41
0
 public ClanListBoxItemRenderer()
 {
     ProfileResourceProvider prp = ProfileResourceProvider.GetForClient(null);
     if (!object.ReferenceEquals(prp, null))
         m_provider = prp.Icons;
 }
示例#42
0
 public override Image GetImage(IIconProvider iconProvider)
 {
     return(iconProvider.GetImage(RDMPConcept.Pipeline, OverlayKind.Add));
 }
示例#43
0
 private ProfileResourceProvider(BattleNetClient client)
 {
     ClientProfile profile = client.Settings as ClientProfile;
     m_iconProvider = IconProviderFactory.GetProvider(profile.IconProviderType);
 }
 public override Image GetImage(IIconProvider iconProvider)
 {
     return(iconProvider.GetImage(RDMPConcept.ConnectionStringKeyword, OverlayKind.Add));
 }
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="locManager">Localization manager of the application</param>
        /// <param name="menuDisp">Menu of the application</param>
        /// <param name="modManager">Modules manager</param>
        /// <param name="iconProvider">Provider of the icons for the component</param>
        /// <param name="toolBar">ToolBar of the application</param>
        public NewBoxTreeView(Menu.ILocalizationManager locManager, 
            Menu.IMenuDisplayer menuDisp, ModulesManager.ModulesManager modManager,
            IIconProvider iconProvider, Menu.IMenuDisplayer toolBar)
            : base()
        {
            //setting the icons
            naIcon = iconProvider.GetIcon("NAIcon");
            folderIcon = iconProvider.GetIcon("FolderIcon");

            localizationManager = locManager;
            menuDisplayer = menuDisp;
            this.toolBar = toolBar;
            modulesManager = modManager;

            InitializeComponent();

            IBoxModuleFactoryCreator[] creators = modulesManager.BoxModuleFactoryCreators;

            FillImageList(creators);
            FillTreeView(creators);

            AfterSelect += new TreeViewEventHandler(NewBoxTreeView_AfterSelect);
            GotFocus += new EventHandler(NewBox_GotFocus);
            MouseMove += new MouseEventHandler(NewBoxTreeView_MouseMove);
            MouseDown += new MouseEventHandler(NewBoxTreeView_MouseDown);
        }