internal AbstractComputer(Cpu cpu, Ram ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard) { this.Cpu = cpu; this.Ram = ram; this.HardDrives = hardDrives; this.VideoCard = videoCard; }
internal Computer(Cpu cpu, IRam ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard) { this.Cpu = cpu; this.Ram = ram; this.HardDrives = hardDrives; this.VideoCard = videoCard; this.motherboard = new Motherboard(this.Cpu, this.Ram, this.VideoCard); }
public PersonalComputer( Cpu cpu, Ram ram, IEnumerable<HardDriver> hardDrives, VideoCard videoCard) : base(cpu, ram, hardDrives, videoCard) { }
public Server(Cpu cpu, Ram ram, IStorageDevice hardDrives, VideoCard videoCard) : base(cpu, ram, hardDrives, videoCard) { if (videoCard.IsMonochrome == false) { throw new ArgumentException("Cannot initialise server with colourful video card"); } }
internal Server( Cpu cpu, Ram ram, IEnumerable<HardDriver> hardDrives, VideoCard videoCard) : base(cpu, ram, hardDrives, videoCard) { }
public Computer(Cpu cpu, Ram ram, VideoCard videoCard, HardDriver hdd, IEnumerable<HardDriver> hardDrives) { this.Cpu = cpu; this.Ram = ram; this.VideoCard = videoCard; this.HardDrive = hdd; this.HardDrives = hardDrives; }
internal Server( Cpu cpu, Ram ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard) : base(cpu, ram, hardDrives, videoCard) { this.VideoCard.IsMonochrome = true; }
public Computer(Cpu cpu, Ram ram, IStorageDevice storage, VideoCard videoCard) { this.CPU = cpu; this.Ram = ram; this.StorageDevice = storage; this.VideoCard = videoCard; this.motherboard = new Motherboard(this.CPU, this.Ram, VideoCard); }
internal Laptop( Cpu cpu, Ram ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard, ILaptopBattery battery) : base(cpu, ram, hardDrives, videoCard) { this.battery = battery; }
internal Laptop( CPUs.Cpu cpu, IRam ram, IEnumerable<HardDriver> hardDrives, VideoCard videoCard, ILaptopBattery laptopBattery) : base(cpu, ram, hardDrives, videoCard) { this.battery = laptopBattery; }
public PC CreatePC() { var ram = new Ram(8); var videoCard = new VideoCard(false); var cpu = new Cpu(4, 64, ram, videoCard); var storage = new HardDrive(1000); var pc = new PC(cpu, ram, storage, videoCard); return pc; }
public Server CreateServer() { var ram = new Ram(64); var videoCard = new VideoCard(true); var cpu = new Cpu(8, 64, ram, videoCard); var storage = new RaidArray(2, 2000); var server = new Server(cpu, ram, storage, videoCard); return server; }
public override PC MakePC() { var cpu = new CPU(2, 64); var ram = new RAM(4); var hardDrives = new List<HardDrive>() { new HardDrive(2000, false, 0) }; var videoCard = new VideoCard(true); var motherboard = new Motherboard(); var pc = new PC(AbstractComputer.ComputerType.PC, cpu, ram, hardDrives, videoCard, null, motherboard); return pc; }
public override Server MakeServer() { var cpu = new CPU(2, 128); var ram = new RAM(8); var hardDrives = new List<HardDrive>() { new HardDrive(500, true, 2), new HardDrive(500, true, 2) }; var videoCard = new VideoCard(true); var motherboard = new Motherboard(); var server = new Server(AbstractComputer.ComputerType.PC, cpu, ram, hardDrives, videoCard, null, motherboard); return server; }
public PC CreatePC() { var ram = new Ram(4); var videoCard = new VideoCard(true); var cpu = new Cpu(2, 64, ram, videoCard); var storage = new HardDrive(2000); var pc = new PC(cpu, ram, storage, videoCard); return pc; }
public override PersonalComputer CreatePC() { var ram = new Ram((int)RamType.GB4); var videoCard = new VideoCard(); var motherBoard = new Motherboard(ram, videoCard); var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits64, motherBoard); var hardDrive = new HardDrive(2000); var pc = new PersonalComputer(motherBoard, cpu, hardDrive); return pc; }
public override Laptop MakeLaptop() { var cpu = new CPU(2, 64); var ram = new RAM(16); var hardDrives = new List<HardDrive>() { new HardDrive(1000, false, 0) }; var videoCard = new VideoCard(false); var motherboard = new Motherboard(); var battery = new Battery(); var laptop = new Laptop(AbstractComputer.ComputerType.PC, cpu, ram, hardDrives, videoCard, battery, motherboard); return laptop; }
public Laptop CreateLaptop() { var ram = new Ram(4); var videoCard = new VideoCard(false); var cpu = new Cpu(4, 32, ram, videoCard); var storage = new HardDrive(1000); var battery = new LaptopBattery(); var laptop = new Laptop(cpu, ram, storage, videoCard, battery); return laptop; }
public override Laptop CreateLaptop() { var ram = new Ram((int)RamType.GB16); var videoCard = new VideoCard(false); var motherBoard = new Motherboard(ram, videoCard); var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits64, motherBoard); var hardDrive = new HardDrive(1000); var laptopBattery = new LaptopBattery(); var laptop = new Laptop(motherBoard, cpu, hardDrive, laptopBattery); return laptop; }
internal Computer(ComputerType type, Cpu cpu, RamMemory ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard, LaptopBattery battery) { this.Cpu = cpu; this.Ram = ram; this.HardDrives = hardDrives; this.VideoCard = videoCard; this.battery = battery; }
private Attachment CreateVideoCard() { var videoCard = new VideoCard(); videoCard.Title = "Vídeo qualquer"; videoCard.Subtitle = "Subtitulo"; videoCard.Autostart = true; videoCard.Autoloop = false; videoCard.Media = new List <MediaUrl> { new MediaUrl("https://youtu.be/Fy6tIMRyuhg?list=RDFy6tIMRyuhg") }; return(videoCard.ToAttachment()); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { IComputer computer = computers.FirstOrDefault(c => c.Id == computerId); if (computer == null) { throw new ArgumentException(String.Format(ExceptionMessages.NotExistingComputerId)); } if (components.Any(c => c.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } IComponent component = null; if (componentType == "CentralProcessingUnit") { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "Motherboard") { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "PowerSupply") { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "RandomAccessMemory") { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "SolidStateDrive") { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "VideoCard") { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } else { throw new ArgumentException(String.Format(ExceptionMessages.InvalidComponentType)); } components.Add(component); computer.AddComponent(component); return(String.Format(SuccessMessages.AddedComponent, componentType, id, computerId)); }
public void Play(int guessNumber) { Cpu.rand(1, 10); var number = Ram.LoadValue(); if (number + 1 != guessNumber + 1) { VideoCard.Draw(string.Format("You didn't guess the number {0}.", number)); } else { VideoCard.Draw("You win!"); } }
private Attachment CreateVideoCard() { var videoCard = new VideoCard(); videoCard.Title = "Um video Qualquer"; videoCard.Subtitle = "Outro titulo"; videoCard.Autostart = true; videoCard.Autoloop = false; videoCard.Media = new List <MediaUrl> { new MediaUrl("http://techslides.com/demos/sample-videos/small.mp4") }; return(videoCard.ToAttachment()); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { ComponentType cType = new ComponentType(); IComponent component = null; if (DoesComputerExist(computerId)) { throw new ArgumentException(COMPUTER_DOESNT_EXIST); } else if (computers.Where(x => x.Id == computerId).Any(x => x.Components.Any(x => x.Id == id))) { throw new ArgumentException("Component with this id already exists."); } else if (!Enum.TryParse <ComponentType>(componentType, out cType)) { throw new ArgumentException("Component type is invalid."); } else if (cType == ComponentType.CentralProcessingUnit) { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.Motherboard) { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.PowerSupply) { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.RandomAccessMemory) { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.SolidStateDrive) { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (cType == ComponentType.VideoCard) { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } components.Add(component); IComputer computer = computers.Where(x => x.Id == computerId).FirstOrDefault(); computer.AddComponent(component); return($"Component {component.GetType().Name} with id {component.Id} added successfully in computer with id {computer.Id}."); }
private async Task ShowKBResponse(List <ApiClient.Model.WebhookMessage> results, ITurnContext context, CancellationToken cancellationToken) { //TODO: Standadize rasa messaging format //var results = await _messagingApi.SendMessageAsync(context.Activity.Conversation.Id, context.Activity.Text); foreach (var r in results) { if (!string.IsNullOrEmpty(r.Text)) { await context.SendActivityAsync(r.Text, cancellationToken : cancellationToken); } if (r.Custom != null) { foreach (var c in r.Custom) { if (c.Videos != null) { IMessageActivity activity = context.Activity.CreateReply(); var attachments = new List <Attachment>(); if (c.Videos.Count > 1) { foreach (var item in c.Videos) { var vCard = new VideoCard(item.Title, media: new List <MediaUrl>() { new MediaUrl { Url = item.Url } }); attachments.Add(vCard.ToAttachment()); } activity = MessageFactory.Carousel(attachments); } else if (c.Videos.Count == 1) { var vCard = new VideoCard(c.Videos.First().Title, media: new List <MediaUrl>() { new MediaUrl { Url = c.Videos.First().Url } }); attachments.Add(vCard.ToAttachment()); activity.Attachments = attachments; } await context.SendActivityAsync(activity, cancellationToken : cancellationToken); } } } } }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { if (!computers.Any(x => x.Id == computerId)) { throw new ArgumentException(ExceptionMessages.NotExistingComputerId); } IComponent componentToAdd; switch (componentType) { case "CentralProcessingUnit": componentToAdd = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); break; case "Motherboard": componentToAdd = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); break; case "PowerSupply": componentToAdd = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); break; case "RandomAccessMemory": componentToAdd = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); break; case "SolidStateDrive": componentToAdd = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); break; case "VideoCard": componentToAdd = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); break; default: throw new ArgumentException(ExceptionMessages.InvalidComponentType); } IComputer computer = computers.First(x => x.Id == computerId); if (computer.Components.Any(x => x.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } computer.AddComponent(componentToAdd); components.Add(componentToAdd); return(string.Format(SuccessMessages.AddedComponent, componentType, id, computerId)); }
public override Server CreateServer() { var ram = new Ram((int)RamType.GB8); var videoCard = new VideoCard(); var motherBoard = new Motherboard(ram, videoCard); var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits128, motherBoard); var hardDriveOne = new HardDrive(500); var hardDriveTwo = new HardDrive(500); var raid = new Raid(500); raid.Add(hardDriveOne); raid.Add(hardDriveTwo); var server = new Server(motherBoard, cpu, raid); return server; }
public override Laptop CreateLaptop() { var ram = new Ram(4); var videoCard = new VideoCard { IsMonochrome = false }; var laptop = new Laptop( new Cpu(2, 64, ram, videoCard), ram, new[] { new HardDrive(500, false, 0) }, videoCard, new LaptopBatteryReal()); return(laptop); }
public bool DeleteVideoCardById(string id) { VideoCard videoCard = _unitOfWork.VideoCards.Get(id); if (videoCard == null) { return(false); } else { _unitOfWork.VideoCards.Remove(videoCard); _unitOfWork.SaveChanges(); return(true); } }
public AbstractComputer(ComputerType type, CPU cpu, RAM ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard, IBattery battery, IMotherboard motherBoard) { this.MachineType = type; this.Cpu = cpu; this.Ram = ram; this.HardDrives = hardDrives; //// TODO: BUG was here ////if (type != ComputerType.LAPTOP && type != ComputerType.PC) ////{ //// VideoCard.IsMonochrome = true; ////} this.VideoCard = videoCard; this.Battery = battery; this.Motherboard = motherBoard; }
public static void SendVideoCardListToFeedRecycler(VideoCard vc, Android.Support.V7.Widget.RecyclerView recyclerView, int id) { if (GetFeedRecyclerViewAdapter == null) { List <VideoCard> vcl = new List <VideoCard>(); vcl.Add(vc); GetFeedRecyclerViewAdapter = new FeedRecyclerViewAdapter(vcl); GetFeedRecyclerViewAdapter.ItemClick += CommonFrag.GetFragmentById(id).RootVideoAdapter_ItemClick; recyclerView.SetAdapter(GetFeedRecyclerViewAdapter); } else { GetFeedRecyclerViewAdapter.UpdateDataSet(vc); } }
private Attachment CreateVideoCard() { var videocard = new VideoCard(); videocard.Title = "R2D2"; videocard.Subtitle = "R2D2 always save the world"; videocard.Autostart = true; videocard.Autoloop = false; videocard.Media = new List <MediaUrl> { new MediaUrl("https://www.youtube.com/watch?v=JLmOteqmDYc") }; return(videocard.ToAttachment()); }
public static VideoCard GetCard() { VideoCard card = new VideoCard { Title = "Press F to Pay Respects", Text = "Respect has been paid", Autoloop = true, Autostart = true, Media = new List <MediaUrl>() }; card.Media.Add(new MediaUrl("https://thumbs.gfycat.com/SkeletalDependableAndeancat-mobile.mp4")); return(card); }
private Attachment CreateVideoCard() { var videoCard = new VideoCard(); videoCard.Title = "Algum video ai man"; videoCard.Subtitle = "Subtitulo do video"; videoCard.Autostart = true; videoCard.Autoloop = false; videoCard.Media = new List <MediaUrl> { new MediaUrl("https://www.youtube.com/watch?v=sNPBN3zlIwo") }; return(videoCard.ToAttachment()); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { if (components.Any(c => c.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } if (!IsValidComponent(componentType)) { throw new ArgumentException(ExceptionMessages.InvalidComponentType); } EnsureExistence(computerId); IComponent component = null; switch (componentType) { case "CentralProcessingUnit": component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); break; case "Motherboard": component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); break; case "PowerSupply": component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); break; case "RandomAccessMemory": component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); break; case "SolidStateDrive": component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); break; case "VideoCard": component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); break; } computers.First(c => c.Id == computerId).AddComponent(component); components.Add(component); return(string.Format(SuccessMessages.AddedComponent, component.GetType().Name, component.Id, computerId)); }
private static async Task SeedVideoCards(ApplicationDbContext dbContext) { using (SqlConnection connection = new SqlConnection(Config.ConnectionString)) { connection.Open(); var command = new SqlCommand(SqlCommands.SelectVideoCardsSql, connection); var videoCards = new List <VideoCard>(); SqlDataReader reader = await command.ExecuteReaderAsync(); try { while (reader.Read()) { var videoCard = new VideoCard { Brand = reader["Brand"].ToString(), Cooler = reader["Cooler"].ToString(), Image = (byte[])reader["Image"], ImgUrl = reader["ImgUrl"].ToString(), DirectX = reader["DirectX"].ToString(), FormFactor = reader["FormFactor"].ToString(), Name = reader["Name"].ToString(), Interface = reader["Interface"].ToString(), GPU = reader["GPU"].ToString(), MaxGPULength = reader["MaxGPULength"].ToString(), Model = reader["Model"].ToString(), OpenGL = reader["OpenGL"].ToString(), SlotWidth = reader["SlotWidth"].ToString(), StreamProcessors = reader["StreamProcessors"].ToString(), SystemRequirements = reader["SystemRequirements"].ToString(), CategoryId = 4, }; videoCards.Add(videoCard); } dbContext.VideoCards.AddRange(videoCards); await dbContext.SaveChangesAsync(); } catch (Exception) { throw; } finally { reader.Close(); } } }
private Attachment GetVideoCard() { var videoCard = new VideoCard() { Title = "Splatoon 2 Soundtrack", Media = new List <MediaUrl>() { new MediaUrl("https://youtu.be/rZaT-PpDAl8") }, Subtitle = "Videmo Demo, by Puck", Autoloop = true, Autostart = true, }; return(videoCard.ToAttachment()); }
public override PersonalComputer MakePersonalComputer() { var ram = new RandomAcessMemory(PersonalComputerRam); var videoCard = new VideoCard(PersonalComputerMonochromeVideoCard); var motherBoard = new Motherboard(ram, videoCard); var cpu = new CentralProcessingUnit(PersonalComputerNumberOfCores, PersonalComputerBits, motherBoard); var hardDrive = new HardDriver(PersonalComputerHardDriveCapacity, false, 0); var dellPersonalComputer = new PersonalComputer( cpu, ram, new List<HardDriver> { hardDrive }, videoCard, motherBoard); return dellPersonalComputer; }
public override Server CreateServer() { var ram1 = new Ram(32); var card = new VideoCard(); var server = new Server( new Cpu(4, 32, ram1, card), ram1, new List <HardDrive> { new HardDrive(0, true, 2, new List <HardDrive> { new HardDrive(1000, false, 0), new HardDrive(1000, false, 0) }) }, card); return(server); }
private Attachment CreateVideoCard() { var videoCard = new VideoCard(); videoCard.Title = "Video do bolo"; videoCard.Subtitle = "Aqui vai um subtitulo"; videoCard.Autoloop = false; videoCard.Autostart = true; videoCard.Media = new List <MediaUrl> { new MediaUrl("https://www.youtube.com/watch?v=ieukcNWempc") }; return(videoCard.ToAttachment()); }
public Activity Create(ActivityData param) { Activity activity = new Activity { Id = Guid.NewGuid().ToString(), Type = "message", Text = param.message, Timestamp = DateTime.UtcNow }; if (!string.IsNullOrWhiteSpace(param.mediaFilePath)) { JContainer container = null; switch (param.contentType) { case AttachmentContentType.Material: MaterialCard matCard = new MaterialCard() { Materials = null, Image = new CardImage(Path.Combine(workflowDirectory, param.mediaFilePath)), Text = activity.Text }; container = JObject.FromObject(matCard); break; case AttachmentContentType.Video: VideoCard videoCard = new VideoCard() { Text = activity.Text, Media = new List <MediaUrl>() { new MediaUrl(Path.Combine(workflowDirectory, param.mediaFilePath)) } }; container = JObject.FromObject(videoCard); break; default: break; } activity.Attachments = new List <Attachment>() { new Attachment(param.contentType, null, container) }; } return(activity); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { var computer = this.computers.FirstOrDefault(x => x.Id == computerId); if (computer == null) { throw new ArgumentException(ExceptionMessages.NotExistingComputerId); } IComponent component = null; if (componentType == ComponentType.CentralProcessingUnit.ToString()) { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == ComponentType.Motherboard.ToString()) { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == ComponentType.PowerSupply.ToString()) { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == ComponentType.RandomAccessMemory.ToString()) { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == ComponentType.SolidStateDrive.ToString()) { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == ComponentType.VideoCard.ToString()) { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } else { throw new ArgumentException(ExceptionMessages.InvalidComponentType); } this.EnsureComponentIdIsUnique(id); computer.AddComponent(component); this.components.Add(component); return(string.Format(SuccessMessages.AddedComponent, componentType, id, computerId)); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { DoesComputerExist(computerId); if (this.components.Any(x => x.Id == id)) { throw new ArgumentException("Component with this id already exists."); } IComponent component = null; if (componentType == "CentralProcessingUnit") { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "Motherboard") { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "PowerSupply") { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "RandomAccessMemory") { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "SolidStateDrive") { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "VideoCard") { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } else { throw new ArgumentException("Component type is invalid."); } this.components.Add(component); this.computers.FirstOrDefault(x => x.Id == computerId) .AddComponent(component); return($"Component {component.GetType().Name} with id {id} added successfully in computer with id {computerId}."); }
public override Server MakeServer() { // TODO:make raid var ram = new RandomAcessMemory(ServerRam); var videoCard = new VideoCard(ServerMonochromeVideoCard); var motherBoard = new Motherboard(ram, videoCard); var cpu = new CentralProcessingUnit(ServerNumberOfCores, ServerBits, motherBoard); var hardDrive = new HardDriver(ServerHardDriveCapacity, false, 0); var dellServer = new Server( cpu, ram, new List<HardDriver> { hardDrive }, videoCard, motherBoard); return dellServer; }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { IComputer comp = IsExist(computerId); if (comp.Components.Any(x => x.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } if (!Enum.TryParse(componentType, out ComponentType)) { throw new ArgumentException(ExceptionMessages.InvalidComponentType); } IComponent component = null; switch (ComponentType) { case ComponentType.CentralProcessingUnit: component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.Motherboard: component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.PowerSupply: component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.RandomAccessMemory: component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.SolidStateDrive: component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); break; case ComponentType.VideoCard: component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); break; } comp.AddComponent(component); components.Add(component); return(string.Format(SuccessMessages.AddedComponent, component.GetType().Name, id, comp.Id)); }
public string AddComponent(int computerId, int id, string componentType, string manufacturer, string model, decimal price, double overallPerformance, int generation) { var pc = ValidateComputer(computerId); if (this.components.Any(x => x.Id == id)) { throw new ArgumentException(ExceptionMessages.ExistingComponentId); } IComponent component; if (componentType == "CentralProcessingUnit") { component = new CentralProcessingUnit(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "Motherboard") { component = new Motherboard(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "PowerSupply") { component = new PowerSupply(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "RandomAccessMemory") { component = new RandomAccessMemory(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "SolidStateDrive") { component = new SolidStateDrive(id, manufacturer, model, price, overallPerformance, generation); } else if (componentType == "VideoCard") { component = new VideoCard(id, manufacturer, model, price, overallPerformance, generation); } else { throw new ArgumentException(ExceptionMessages.InvalidComponentType); } this.components.Add(component); pc.AddComponent(component); return(string.Format(SuccessMessages.AddedComponent, componentType, id, computerId)); }
public static VideoCard GetYoutubeCard() { var youtubeCard = new VideoCard { Media = new List <MediaUrl> { new MediaUrl() { Url = "https://www.youtube.com/watch?v=YYV-OZIv8eg", }, }, Autostart = true, Shareable = true, }; return(youtubeCard); }
private Attachment GetVideoCard() { var videoCard = new VideoCard { Title = "Video", Subtitle = "Video Development", Media = new List <MediaUrl> { new MediaUrl() { Url = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4" } } }; return(videoCard.ToAttachment()); }
private async Task <VideoCard> VideoCardCreation(string name, string content) { VideoCard myCard = new VideoCard { Title = name, Text = content, Media = new List <MediaUrl> { new MediaUrl() { Url = "https://www.youtube.com/watch?v=HgtO2L8FbpI" } } }; return(myCard); }
async Task HandleVideoAsync(IDialogContext context) { string contentUrl = GetBinaryUrl("cortana.mp4"); var videoCard = new VideoCard( "Chatbot Video", "Calling With the Cortana Channel", "This demonstrates how to speak with a chatbot via Cortana.", media: new List<MediaUrl> { new MediaUrl(contentUrl) }); Activity activity = context.Activity as Activity; Activity reply = activity.CreateReply(); reply.Attachments.Add(videoCard.ToAttachment()); await new ConnectorClient(new Uri(reply.ServiceUrl)) .Conversations .SendToConversationAsync(reply); context.Wait(MessageReceivedAsync); }
public async Task <bool> ExcuteAsync() { Activity replyToConversation = (Activity)Context.MakeMessage(); replyToConversation.Recipient = replyToConversation.Recipient; replyToConversation.Type = "message"; //replyToConversation.Text = WebUtility.HtmlDecode(Message); replyToConversation.TextFormat = TextFormatTypes.Markdown; Attachment cardAttachment = null; VideoCard videoCard = new VideoCard() { //Title = "Breaking Bad", //Subtitle = "Breaking Bad is an American crime drama television series created and produced by Vince Gilligan.", //Image = new ThumbnailUrl() //{ // Url = "https://upload.wikimedia.org/wikipedia/en/thumb/6/61/Breaking_Bad_title_card.png/250px-Breaking_Bad_title_card.png" //}, Media = new List <MediaUrl>() { new MediaUrl() { Url = $"{Message}" } }, Buttons = new List <CardAction>() { new CardAction() { Title = "Watch All Episodes", Type = ActionTypes.OpenUrl, Value = $"{Message}" } } }; cardAttachment = videoCard.ToAttachment(); replyToConversation.Attachments.Add(cardAttachment); await Context.PostAsync(replyToConversation); return(false); }
public override Laptop MakeLaptop() { var ram = new RandomAcessMemory(LaptopRam); var videoCard = new VideoCard(LaptopMonochromeVideoCard); var motherBoard = new Motherboard(ram, videoCard); var cpu = new CentralProcessingUnit(LaptopNumberOfCores, LaptopBits, motherBoard); var hardDrive = new HardDriver(LaptopHardDriveCapacity, false, 0); var battery = new LaptopBattery(); var dellLaptop = new Laptop( cpu, ram, new List<HardDriver> { hardDrive }, videoCard, motherBoard, battery); return dellLaptop; }
private static Attachment GetVideoCard() { var vCard = new VideoCard { Title = "SignBot Video Card", Subtitle = "Your bots — wherever your users are talking", Text = "Build and connect intelligent bots to interact with your users naturally wherever they are, from text/sms to Skype, Slack, Office 365 mail and other popular services.", Media = new List <MediaUrl> { new MediaUrl("http://res.cloudinary.com/dwa0fvkfp/video/upload/v1475410603/yse5x1qpldluz4cw3ss1.mp4") }, Buttons = new List <CardAction> { new CardAction(ActionTypes.OpenUrl, "Get Started", value: "https://docs.botframework.com/en-us/") } }; return(new Attachment("video/mp4", vCard.Media[0].Url));;//.ToAttachmenet();//.ToAttachment(); }
private static Attachment GetVideoCard() { var videoCard = new VideoCard { Title = "Watch An Automation Script In Action", Subtitle = "Process Automation Demo", Media = new List <MediaUrl>() { new MediaUrl() { // Url = "https://youtu.be/a02i_Ik4GGM" Url = "https://blobstoragechatbot.blob.core.windows.net/autobotmedia/sample.mp4" } }, }; return(videoCard.ToAttachment()); }
public static void main() { var manufacturer = Console.ReadLine(); if (manufacturer == "HP") { var ram = new RamMemory(Eight / 4); var videoCard = new VideoCard(false); var cpu = new Cpu(Eight / 4, 32, ram, videoCard); var hardDrives = new[] { new HardDrive(500, false, 0) }; pc = new Computer(ComputerType.Pc, cpu, ram, hardDrives, videoCard, null); var serverRam = new RamMemory(Eight * 4); var serverVideo = new HardDrive(); server = new Computer( ComputersFactory.Type.SERVER, new Cpu(Eight / 2, 32, serverRam, serverVideo), serverRam, new List<HardDrive>{ new HardDrive(0, true, 2, new List<HardDrive> { new HardDrive(1000, false, 0), new HardDrive(1000, false, 0) }) }, serverVideo, null); { var card = new HardDrive() { IsMonochrome = false }; var ram1 = new RamMemory(Eight / 2); laptop = new Computer( ComputersFactory.Type.LAPTOP, new Cpu(Eight / 4, 64, ram1, card), ram1, new[] { new HardDrive(500, false, 0) }, card, new LaptopBattery()); } } else if (manufacturer == "Dell") { var ram = new RamMemory(Eight); var videoCard = new HardDrive() { IsMonochrome = false }; pc = new Computer(ComputersFactory.Type.PC, new Cpu(Eight / 2, 64, ram, videoCard), ram, new[] { new HardDrive(1000, false, 0) }, videoCard, null); var ram1 = new RamMemory(Eight * Eight); var card = new HardDrive(); server = new Computer(ComputersFactory.Type.SERVER, new Cpu(Eight, 64, ram1, card), ram1, new List<HardDrive>{ new HardDrive(0, true, 2, new List<HardDrive> { new HardDrive(2000, false, 0), new HardDrive(2000, false, 0) }) }, card, null); var ram2 = new RamMemory(Eight); var videoCard1 = new HardDrive() { IsMonochrome = false }; laptop = new Computer(ComputersFactory.Type.LAPTOP, new Cpu(Eight / 2, ((32)), ram2, videoCard1), ram2, new[] { new HardDrive(1000, false, 0) }, videoCard1, new LaptopBattery()); } else { throw new InvalidArgumentException("Invalid manufacturer!"); } while (1 == 1) { var c = Console.ReadLine(); if (c == null) goto end; if (c.StartsWith("Exit")) goto end; var cp = c.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (cp.Length != 2) { { throw new ArgumentException("Invalid command!"); } } #warning "This code sucks" var cn = cp[0]; var ca = int.Parse(cp[1]); if (cn == "Charge") laptop.ChargeBattery(ca); else if (cn == "Process") server.Process(ca); else if (cn == "Play") pc.Play(ca); ; continue; Console.WriteLine("Invalid command!"); } end: ; }
public Laptop(Cpu cpu, Ram ram, VideoCard videoCard, HardDriver hdd, IEnumerable<HardDriver> hardDrives, Battery battery) : base(cpu, ram, videoCard, hdd, hardDrives) { this.Battery = battery; }
public Motherboard(Cpu cpu, Ram ram, VideoCard videoCard) { this.cpu = cpu; this.ram = ram; this.videoCard = videoCard; }
public Motherboard(Cpu cpu, VideoCard videoCard, IRam ram) { cpu.AttachTo(this); this.Ram = ram; this.VideoCard = videoCard; }
public Laptop(AbstractComputer.ComputerType type, CPU cpu, RAM ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard, IBattery battery, IMotherboard motherBoard) : base(type, cpu, ram, hardDrives, videoCard, battery, motherBoard) { }