public InterfaceResourceDetail(Interface iface, VirtualMachine virtualMachine) { this.iface = iface; this.virtualMachine = virtualMachine; this.Value = String.Format( InterfaceResourceDetail.ValueTemplate, iface.Bandwidth, iface.IpAddressIds.Length, (iface.IpAddressIds.Length <= 1 ? null : InterfaceResourceDetail.PluralSuffix)); ResourceDetailAction detachAction = new ResourceDetailAction(InterfaceResourceDetail.DetachCommandName, true); detachAction.Command = new RelayCommand((parameter) => this.Detach(parameter)); ResourceDetailAction seeIpAddressesAction = new ResourceDetailAction(String.Format(InterfaceResourceDetail.SeeIpAddressesCommandName, (iface.IpAddressIds.Length <= 1 ? null : InterfaceResourceDetail.PluralSuffix))); seeIpAddressesAction.Command = new RelayCommand((parameter) => this.SeeIpAddresses(parameter)); ResourceDetailAction editAction = new ResourceDetailAction(InterfaceResourceDetail.EditCommandName); editAction.Command = new RelayCommand((parameter) => this.Edit(parameter)); this.Actions = new ResourceDetailAction[] { detachAction, seeIpAddressesAction, editAction }; }
public StatusResourceDetail(VirtualMachine virtualMachine) { this.virtualMachine = virtualMachine; string status = virtualMachine.Status.ToString(); status = status.Replace('_', ' '); status = status.Substring(0, 1).ToUpperInvariant() + status.Substring(1); this.Value = status; ResourceDetailAction startAction = new ResourceDetailAction(StatusResourceDetail.StartCommandName, true); startAction.Command = new RelayCommand((parameter) => this.Start(parameter), (parameter) => this.CanStart(parameter)); ResourceDetailAction stopAction = new ResourceDetailAction(StatusResourceDetail.StopCommandName, true); stopAction.Command = new RelayCommand((parameter) => this.Stop(parameter), (parameter) => this.CanStop(parameter)); ResourceDetailAction rebootAction = new ResourceDetailAction(StatusResourceDetail.RebootCommandName, true); rebootAction.Command = new RelayCommand((parameter) => this.Reboot(parameter), (parameter) => this.CanReboot(parameter)); this.Actions = new ResourceDetailAction[] { startAction, stopAction, rebootAction }; }
public IpAddressResourceDetail(IpAddress ipAddress) { this.ipAddress = ipAddress; this.Value = ipAddress.Ip.ToString(); ResourceDetailAction copyAction = new ResourceDetailAction(IpAddressResourceDetail.CopyCommandName); copyAction.Command = new RelayCommand((parameter) => this.Copy(parameter)); ResourceDetailAction detachAction = new ResourceDetailAction(IpAddressResourceDetail.DetachCommandName, true); detachAction.Command = new RelayCommand((parameter) => this.Detach(parameter)); ResourceDetailAction editAction = new ResourceDetailAction(IpAddressResourceDetail.EditCommandName); editAction.Command = new RelayCommand((parameter) => this.Edit(parameter)); this.Actions = new ResourceDetailAction[] { copyAction, //detachAction, editAction }; }
public DiskResourceDetail(Disk disk, VirtualMachine virtualMachine) { this.disk = disk; this.virtualMachine = virtualMachine; this.Value = String.Format(DiskResourceDetail.ValueTemplate, disk.Name, (disk.Size / 1000)); if (disk.IsBootDisk) this.Type = ResourceDetailType.SystemDisk; else this.Type = ResourceDetailType.Disk; ResourceDetailAction detachAction = new ResourceDetailAction(DiskResourceDetail.DetachCommandName, true); detachAction.Command = new RelayCommand((parameter) => this.Detach(parameter)); ResourceDetailAction editAction = new ResourceDetailAction(DiskResourceDetail.EditCommandName); editAction.Command = new RelayCommand((parameter) => this.Edit(parameter)); this.Actions = new ResourceDetailAction[] { detachAction, editAction }; }
public ResourceDetailActionViewModel(ResourceDetailAction resourceDetailAction) { this.Name = resourceDetailAction.Name; this.Command = resourceDetailAction.Command; this.ConfirmationRequired = resourceDetailAction.ConfirmationRequired; }