예제 #1
0
        /// <summary>
        /// Creates a category for a given parent. This sets the
        /// <see cref="ConnectionParent"/> reference, but does not
        /// automatically add the category to the parent's
        /// <see cref="SubConnections"/> collection.
        /// </summary>
        public ConnectionItem(string connectionName, ConnectionTypeItems connectionType, ConnectionItem connectionParent, ImageSource connectionIcon, Collection <ImageSource> connectionIconOverlay, long connectionId, string connectionHost, string connectionDescription, string connectionCredentialName)
        {
            _ConnectionName          = connectionName;
            _ConnectionType          = connectionType;
            _ConnectionParent        = connectionParent;
            _ConnectionID            = connectionId;
            ConnectionHost           = connectionHost;
            ConnectionDescription    = connectionDescription;
            ConnectionCredentialName = connectionCredentialName;

            if (connectionIconOverlay != null)
            {
                ConnectionIconOverlays = connectionIconOverlay;
            }

            //Set the default ConnectionIcon for the given type of connection if it is a connection or a protocol
            if (connectionIcon == null && connectionType != ConnectionTypeItems.option)
            {
                try
                {
                    var icon = new BitmapImage();

                    icon.BeginInit();

                    switch (connectionType)
                    {
                    case ConnectionTypeItems.connection:
                        icon.UriSource = new Uri("pack://application:,,,/beRemote.GUI.Controls;component/Images/screen16.png", UriKind.Absolute);
                        break;

                    case ConnectionTypeItems.protocol:
                        icon.UriSource = new Uri("pack://application:,,,/beRemote.GUI.Controls;component/Images/missing16.png", UriKind.Absolute);
                        break;

                    case ConnectionTypeItems.folder:
                        icon.UriSource = new Uri("pack://application:,,,/beRemote.GUI.Controls;component/Images/folder16.png", UriKind.Absolute);
                        break;
                        //Not required; Loaded by UI and saves Cache
                        //case ConnectionTypeItems.option:
                        //    icon.UriSource = new Uri("pack://application:,,,/beRemote.GUI.Controls;component/Images/missing16.png", UriKind.Absolute);
                        //    break;
                    }

                    icon.EndInit();
                    icon.Freeze();

                    ConnectionIcon = icon;
                }
                catch (Exception ea)
                {
                    Logger.Log(LogEntryType.Exception, "Error on loading ConnectionIcon", ea);
                }
            }
            else
            {
                ConnectionIcon = connectionIcon;
            }
        }
예제 #2
0
 public ConnectionItem(string connectionName, ConnectionTypeItems connectionType, ConnectionItem connectionParent)
     : this(connectionName, connectionType, connectionParent, null, null, 0, "", "", "")
 {
 }
예제 #3
0
 public ConnectionItem(string connectionName, ConnectionTypeItems connectionType, ConnectionItem connectionParent, BitmapImage connectionIcon)
     : this(connectionName, connectionType, connectionParent, connectionIcon, null, 0, "", "", "")
 {
 }
예제 #4
0
 /// <summary>
 /// Creates a category without a parent.
 /// </summary>
 /// <param name="categoryName">The category's name.</param>
 public ConnectionItem(string connectionName, ConnectionTypeItems connectionType)
     : this(connectionName, connectionType, null)
 {
 }