Beispiel #1
0
        public MapUIElement(UIType ObjectType, NetworkAdapterType NetworkAdapterType)
        {
            privateObjectType         = ObjectType;
            privateNetworkAdapterType = NetworkAdapterType;

            if (ObjectType == UIType.Module)
            {
                Uri         uri    = new Uri("pack://application:,,,/SMCenter.NetworkTasksLib;component/Resources/Module48x48.png");
                BitmapImage bitmap = new BitmapImage(uri);
                this.Source    = bitmap;
                this.MaxHeight = 7;
            }
            else if (ObjectType == UIType.Computer)
            {
                Uri uri = new Uri("pack://application:,,,/SMCenter.NetworkTasksLib;component/Resources/monitor_48.png");
                //Uri uri = new Uri("/application:,,component/Resources/monitor_48.png");
                BitmapImage bitmap = new BitmapImage(uri);

                this.Source    = bitmap;
                this.MaxHeight = 7;
            }
            else if (ObjectType == UIType.Rack)
            {
                Uri         uri    = new Uri("pack://application:,,,/SMCenter.NetworkTasksLib;component/Resources/rack2.png");
                BitmapImage bitmap = new BitmapImage(uri);
                this.Source    = bitmap;
                this.MaxHeight = 7;
            }
            else if (ObjectType == UIType.Node)
            {
                Uri         uri    = new Uri("pack://application:,,,/SMCenter.NetworkTasksLib;component/Resources/Node48x48.png");
                BitmapImage bitmap = new BitmapImage(uri);
                this.Source    = bitmap;
                this.MaxHeight = 7;
            }
            else if (ObjectType == UIType.Server)
            {
                Uri         uri    = new Uri("pack://application:,,,/SMCenter.NetworkTasksLib;component/Resources/server_48.png");
                BitmapImage bitmap = new BitmapImage(uri);
                this.Source    = bitmap;
                this.MaxHeight = 7;
            }
            else if (ObjectType == UIType.Printer)
            {
                //Uri uri = new Uri("pack://application:,,,/SMCenter.NetworkTasksLib;component/Resources/monitor_48.png");
                Uri         uri    = new Uri("pack://application:,,,/SMCenter.NetworkTasksLib;component/Resources/printer_48.png");
                BitmapImage bitmap = new BitmapImage(uri);
                this.Source    = bitmap;
                this.MaxHeight = 7;
            }
            else if (ObjectType == UIType.Room)
            {
                Uri uri = new Uri("pack://application:,,,/SMCenter.NetworkTasksLib;component/Resources/Circle.png");
                //Uri uri = new Uri("/Resources/square_48.png", UriKind.Relative);
                BitmapImage bitmap = new BitmapImage(uri);
                this.Source    = bitmap;
                this.MaxHeight = 25;
            }
            //computer.Source = bitmap;
        }
Beispiel #2
0
 public VirtualNetworkCard(
     int nicId,
     bool isConnected,
     string networkName,
     bool isPrimaryNetworkConnection,
     IpAddressAllocationModeType ipAddressingMode,
     string ipAddress,
     NetworkAdapterType adapterType)
     : base(new RASD_Type())
 {
     this.Init(nicId, isConnected, networkName, isPrimaryNetworkConnection, ipAddressingMode, ipAddress, adapterType);
 }
Beispiel #3
0
        private void Init(
            int nicId,
            bool isConnected,
            string networkName,
            bool isPrimaryNetworkConnection,
            IpAddressAllocationModeType ipAddressingMode,
            string ipAddress,
            NetworkAdapterType adapterType)
        {
            cimString cimString1 = new cimString();

            cimString1.Value = networkName;
            List <XmlAttribute> xmlAttributeList = new List <XmlAttribute>();
            XmlDocument         xmlDocument      = new XmlDocument();
            XmlAttribute        attribute1       = xmlDocument.CreateAttribute("vcloud", nameof(ipAddress), "http://www.vmware.com/vcloud/v1.5");

            attribute1.Value = ipAddress;
            XmlAttribute attribute2 = xmlDocument.CreateAttribute("vcloud", "primaryNetworkConnection", "http://www.vmware.com/vcloud/v1.5");

            attribute2.Value = isPrimaryNetworkConnection.ToString();
            XmlAttribute attribute3 = xmlDocument.CreateAttribute("vcloud", nameof(ipAddressingMode), "http://www.vmware.com/vcloud/v1.5");

            attribute3.Value = ipAddressingMode.Value();
            xmlAttributeList.Add(attribute1);
            xmlAttributeList.Add(attribute2);
            xmlAttributeList.Add(attribute3);
            if (cimString1.AnyAttr == null)
            {
                cimString1.AnyAttr = xmlAttributeList.ToArray();
            }
            else
            {
                List <XmlAttribute> list = ((IEnumerable <XmlAttribute>)cimString1.AnyAttr).ToList <XmlAttribute>();
                list.AddRange((IEnumerable <XmlAttribute>)xmlAttributeList);
                cimString1.AnyAttr = list.ToArray();
            }
            cimString cimString2 = new cimString();

            cimString2.Value = "";
            cimString cimString3 = new cimString();

            cimString3.Value = "";
            cimString cimString4 = new cimString();

            cimString4.Value = nicId.ToString();
            cimBoolean cimBoolean = new cimBoolean();

            cimBoolean.Value = isConnected;
            ResourceType1 resourceType1 = new ResourceType1();

            resourceType1.Value = "10";
            cimString cimString5 = new cimString();

            cimString5.Value = adapterType.Value();
            RASD_Type itemResource = this.GetItemResource();

            itemResource.ElementName         = cimString2;
            itemResource.InstanceID          = cimString3;
            itemResource.ResourceType        = resourceType1;
            itemResource.ResourceSubType     = cimString5;
            itemResource.AddressOnParent     = cimString4;
            itemResource.AutomaticAllocation = cimBoolean;
            itemResource.Connection          = new cimString[1]
            {
                cimString1
            };
        }