public void ReadOnlyTests() { // Arrange var provider = new DataAnnotationsModelMetadataProvider(); IModelFlattener test = new DefaultModelFlattener(); var model = new DisplayModel(); var result = test.Flatten(model, model.GetType(), provider, string.Empty); Assert.NotNull(result); }
public void Should_dynamic_map_the_object_type() { var displayModel = new DisplayModel { Radius = 300 }; object vm = new SomeViewModel(); Mapper.DynamicMap(displayModel, vm); ((SomeViewModel)vm).Radius.ShouldEqual(300); // fails var vm2 = new SomeViewModel(); Mapper.DynamicMap(displayModel, vm2); vm2.Radius.ShouldEqual(300); // succeeds }
public void display_attribute_takes_precedence_over_displayname_attribute() { var model = new DisplayModel(); var context = new ValidationContext(model); var results = new List<ValidationResult>(); model.Value3 = null; Validator.TryValidateObject(model, context, results, true); Assert.Equal("requiredif only chosen", results.Single().ErrorMessage); results.Clear(); model.Value3 = new object(); Validator.TryValidateObject(model, context, results, true); Assert.Equal("assertthat only chosen", results.Single().ErrorMessage); }
public void Should_map_the_object_type() { var displayModel = new DisplayModel { Radius = 300 }; object vm = new SomeViewModel(); var config = new MapperConfiguration(cfg => cfg.CreateMap<DisplayModel, SomeViewModel>()); var mapper = config.CreateMapper(); mapper.Map(displayModel, vm); ((SomeViewModel)vm).Radius.ShouldEqual(300); // fails var vm2 = new SomeViewModel(); mapper.Map(displayModel, vm2); vm2.Radius.ShouldEqual(300); // succeeds }
public async Task <ActionResult> NeedNewPasswordDisplay() { if (!Manager.NeedNewPassword) { return(new EmptyResult()); } if (Manager.EditMode) { return(new EmptyResult()); } if (Manager.IsInPopup) { return(new EmptyResult()); } using (UserLoginInfoDataProvider logInfoDP = new UserLoginInfoDataProvider()) { if (await logInfoDP.IsExternalUserAsync(Manager.UserId)) { return(new EmptyResult()); } } UserPasswordModule modNewPassword = (UserPasswordModule)await ModuleDefinition.LoadAsync(ModuleDefinition.GetPermanentGuid(typeof(UserPasswordModule))); if (modNewPassword == null) { throw new InternalError($"nameof(UserPasswordModule) module not found"); } LoginConfigData config = await LoginConfigDataProvider.GetConfigAsync(); ModuleAction actionNewPassword = modNewPassword.GetAction_UserPassword(config.ChangePasswordUrl); if (actionNewPassword == null) { throw new InternalError("Change password action not found"); } DisplayModel model = new DisplayModel { ChangePasswordAction = actionNewPassword, }; return(View(model)); }
public void Should_map_the_object_type() { var displayModel = new DisplayModel { Radius = 300 }; object vm = new SomeViewModel(); var config = new MapperConfiguration(cfg => cfg.CreateMap <DisplayModel, SomeViewModel>()); var mapper = config.CreateMapper(); mapper.Map(displayModel, vm); ((SomeViewModel)vm).Radius.ShouldBe(300); // fails var vm2 = new SomeViewModel(); mapper.Map(displayModel, vm2); vm2.Radius.ShouldBe(300); // succeeds }
public async Task <ActionResult> DisqusLinks(string disqus) { using (DisqusConfigDataProvider dataProvider = new DisqusConfigDataProvider()) { DisqusConfigData config = await dataProvider.GetItemAsync(); if (config == null) { return(new EmptyResult()); } if (string.IsNullOrWhiteSpace(config.ShortName)) { return(new EmptyResult()); } DisplayModel model = new DisplayModel { ShortName = config.ShortName, }; return(View(model)); } }
/// <summary> /// Initializes a new instance of the <see cref="OledDisplaySsd1306"/> class. /// </summary> /// <param name="device">The device.</param> /// <param name="model">The model.</param> /// <param name="vccSource">State of the VCC.</param> /// <exception cref="ArgumentException">Invalid display model - model.</exception> /// <exception cref="ArgumentNullException">device.</exception> public OledDisplaySsd1306(II2CDevice device, DisplayModel model, VccSourceMode vccSource) { switch (model) { case DisplayModel.Display128X32: { Width = 128; Height = 32; break; } case DisplayModel.Display128X64: { Width = 128; Height = 64; break; } case DisplayModel.Display96X16: { Width = 96; Height = 16; break; } default: { throw new ArgumentException("Invalid display model", nameof(model)); } } Model = model; Device = device ?? throw new ArgumentNullException(nameof(device)); VccSource = vccSource; _bufferPageCount = Height / 8; _bitBuffer = new BitArray(Width * Height); _byteBuffer = new byte[1 + (_bitBuffer.Length / 8)]; _byteBuffer[0] = 0x40; // The first byte signals data _bitsPerPage = 8 * Width; Initialize(); IsActive = true; }
// [Test()] public void ExecuteDatabaseRenderer() { var start = DateTime.Now; System.Diagnostics.Debug.WriteLine(string.Format("Start: {0}", DateTime.Now.ToString("hh:mm:ss.fff"))); var filename = PortablePath.Combine(new string[] { "baden-wuerttemberg.map" }); var file = FileSystem.Current.LocalStorage.GetFileAsync(PortablePath.Combine(new string[] { "baden-wuerttemberg.map" })).Result; var mapFile = new MapFile(FileSystem.Current.LocalStorage.GetFileAsync(PortablePath.Combine(new string[] { "baden-wuerttemberg.map" })).Result); var graphicFactory = new SkiaGraphicFactory(); var tileCache = new InMemoryTileCache(20); var renderer = new DatabaseRenderer(mapFile, graphicFactory, tileCache); var renderTheme = ExternalRenderTheme.CreateExternalRenderTheme(PortablePath.Combine(new string[] { "osmarender", "osmarender.xml" })); var displayModel = new DisplayModel(); var renderThemeFuture = new RenderThemeFuture(graphicFactory, renderTheme, displayModel); System.Diagnostics.Debug.WriteLine(string.Format("Before RenderJob: {0}", DateTime.Now.ToString("hh:mm:ss.fff"))); var renderJob = new RendererJob(new Tile(4306, 2831, 13, 256), mapFile, renderThemeFuture, displayModel, 1, false, false); //var renderJob = new RendererJob(new core.model.Tile(17220, 11324, 15, 256), mapFile, renderThemeFuture, displayModel, 1, false, false); //var renderJob = new RendererJob(new core.model.Tile(34440, 22648, 16, 256), mapFile, renderThemeFuture, displayModel, 1, false, false); //var renderJob = new RendererJob(new core.model.Tile(68881, 45297, 17, 256), mapFile, renderThemeFuture, displayModel, 1, false, false); System.Diagnostics.Debug.WriteLine(string.Format("After RenderJob: {0}", DateTime.Now.ToString("hh:mm:ss.fff"))); System.Diagnostics.Debug.WriteLine(string.Format("Before ExecuteJob: {0}", DateTime.Now.ToString("hh:mm:ss.fff"))); var tile = renderer.ExecuteJob(renderJob); System.Diagnostics.Debug.WriteLine(string.Format("After ExecuteJob: {0}", DateTime.Now.ToString("hh:mm:ss.fff"))); System.Diagnostics.Debug.WriteLine(string.Format("Before image write: {0}", DateTime.Now.ToString("hh:mm:ss.fff"))); var output = FileSystem.Current.LocalStorage.CreateFileAsync("Tile.4305.2831.13.png", CreationCollisionOption.ReplaceExisting).Result; using (var outputStream = output.OpenAsync(FileAccess.ReadAndWrite).Result) { tile.Encode().AsStream().CopyTo(outputStream); } output = null; System.Diagnostics.Debug.WriteLine(string.Format("After image write: {0}", DateTime.Now.ToString("hh:mm:ss.fff"))); System.Diagnostics.Debug.WriteLine(string.Format("End: {0}", DateTime.Now.ToString("hh:mm:ss.fff"))); System.Diagnostics.Debug.WriteLine(string.Format("Time to render: {0}", (DateTime.Now - start).ToString())); }
public async Task <ActionResult> DisplayVoiceMail(int id) { using (VoiceMailDataProvider voiceMailDP = new VoiceMailDataProvider()) { VoiceMailData voiceMail = await voiceMailDP.GetItemByIdentityAsync(id); if (voiceMail == null) { throw new Error(this.__ResStr("notFound", "Voice mail entry with id {0} not found"), id); } voiceMail.Heard = true; await voiceMailDP.UpdateItemAsync(voiceMail); DisplayModel model = new DisplayModel() { Listen = await Module.GetAction_ListenAsync(voiceMail.RecordingUrl) }; model.SetData(voiceMail); return(View(model)); } }
public async Task <ActionResult> VisitorSummary() { using (VisitorEntryDataProvider visitorDP = new VisitorEntryDataProvider()) { if (visitorDP.Usable) { await Manager.AddOnManager.AddAddOnNamedAsync(AreaRegistration.CurrentPackage.AreaName, Module.ModuleName); // add module specific items VisitorEntryDataProvider.Info info = await visitorDP.GetStatsAsync(); DisplayModel model = new DisplayModel { }; model.TodaysAnonymous = info.TodaysAnonymous; model.TodaysUsers = info.TodaysUsers; model.YesterdaysAnonymous = info.YesterdaysAnonymous; model.YesterdaysUsers = info.YesterdaysUsers; return(View(model)); } return(new EmptyResult()); } }
public async Task <ActionResult> SkinTawkTo() { ConfigData config = await ConfigDataProvider.GetConfigAsync(); if (Manager.EditMode || !config.IsConfigured) { return(new EmptyResult()); } DisplayModel model = new DisplayModel(); if (Manager.HaveUser) { byte[] key = System.Text.Encoding.UTF8.GetBytes(config.APIKey); using (var hmacsha256 = new System.Security.Cryptography.HMACSHA256(key)) { model.Hash = ByteArrayToString(hmacsha256.ComputeHash(System.Text.Encoding.UTF8.GetBytes(Manager.UserEmail))); } } return(View(model)); }
public async Task <DisplayModel> DisplayModelList1() { var date = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time")).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); string lang = "E"; HttpCookie cookie = HttpContext.Request.Cookies["Home"]; if (cookie != null && cookie.Value != null) { if (cookie.Value == "en-Us") { lang = "E"; } else { lang = "da"; } } DetailAPI detailAPI = new DetailAPI(); DisplayModel dtl = new DisplayModel(); HttpClient client = detailAPI.Initial(); dtl = GetCookie("DisplayModelLists"); if (dtl != null) { } else { HttpResponseMessage res = await client.GetAsync("https://restaurantapi.padhyasoft.com/api/SettingMsg/GetSettingMessages?curdate=" + date + "&langcode=" + lang); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; dtl = JsonConvert.DeserializeObject <DisplayModel>(result); AddCookie(dtl); } } // CommonViewModel.DisplayModels = dtl; return(dtl); }
public async Task <ActionResult> Summary() { //int category; //Manager.TryGetUrlArg<int>("BlogCategory", out category); BlogConfigData config = await BlogConfigDataProvider.GetConfigAsync(); using (BlogEntryDataProvider dataProvider = new BlogEntryDataProvider()) { List <DataProviderSortInfo> sort = new List <DataProviderSortInfo> { new DataProviderSortInfo { Field = nameof(BlogEntry.DatePublished), Order = DataProviderSortInfo.SortDirection.Descending }, }; List <DataProviderFilterInfo> filters = new List <DataProviderFilterInfo> { new DataProviderFilterInfo { Field = nameof(BlogEntry.Published), Operator = "==", Value = true }, }; //if (category != 0) // filters = DataProviderFilterInfo.Join(filters, new DataProviderFilterInfo { Field = nameof(BlogEntry.CategoryIdentity), Operator = "==", Value = category }); DataProviderGetRecords <BlogEntry> data = await dataProvider.GetItemsAsync(0, Module.Entries, sort, filters); if (data.Data.Count == 0) { return(new EmptyResult()); } EntryDisplayModule dispMod = new EntryDisplayModule(); List <Entry> list = new List <Entry>(); foreach (BlogEntry d in data.Data) { ModuleAction viewAction = await dispMod.GetAction_DisplayAsync(d.Identity); list.Add(new Entry(d, dispMod, viewAction)); } DisplayModel model = new DisplayModel() { BlogEntries = list, }; return(View(model)); } }
public ActionResult DisplayHeaders() { DisplayModel model = new DisplayModel(); foreach (var hdr in Request.Headers) { model.Headers.Add(hdr.ToString()); } model.Variables.Add($"{nameof(Manager.HostSchemeUsed)} = {Manager.HostSchemeUsed}"); model.Variables.Add($"{nameof(Manager.HostPortUsed)} = {Manager.HostPortUsed}"); model.Variables.Add($"{nameof(Manager.HostUsed)} = {Manager.HostUsed}"); model.Variables.Add($"{nameof(YetaWFManager.IsHTTPSite)} = {YetaWFManager.IsHTTPSite}"); model.Variables.Add($"{nameof(Manager.IsLocalHost)} = {Manager.IsLocalHost}"); model.Variables.Add($"{nameof(Manager.CurrentRequestUrl)} = {Manager.CurrentRequestUrl}"); model.Variables.Add($"UriHelper.GetDisplayUrl(Manager.CurrentRequest) = {UriHelper.GetDisplayUrl(Manager.CurrentRequest)}"); model.Variables.Add($"{nameof(Manager.CurrentRequest.Scheme)} = {Manager.CurrentRequest.Scheme}"); model.Variables.Add($"{nameof(Manager.CurrentRequest.IsHttps)} = {Manager.CurrentRequest.IsHttps}"); model.Variables.Add($"{nameof(Manager.CurrentRequest.Host)} = {Manager.CurrentRequest.Host}"); return(View(model)); }
public async Task <ActionResult> Index() { Session["selectedmenu"] = "Contact"; DisplayModel dt = new DisplayModel(); dt = await DisplayModelList1(); if (dt.DisplayMsgResClose == "Y") { ViewBag.IsMsgDisplay = "Y"; ViewBag.displaymsg = dt.ResCloseMsg; } else { ViewBag.IsMsgDisplay = "N"; ViewBag.displaymsg = ""; } return(View()); }
private void LoadFile(string filename) { try { var building = Loader.Load(filename); _displayModel = Converter.Convert(building); } catch (Exception ex) { MessageBox.Show($"Unable to load file: {filename}.\n error: {ex.Message}", "Loading failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var(minWorld, maxWorld) = DisplayModelQuery.GetModelBounds(_displayModel); _viewPort = new ViewPort(pbMain.Width, pbMain.Height, minWorld, maxWorld); _renderer = new Renderer(_displayModel, _viewPort); }
public async Task <ActionResult> SMSProcessorStatus() { if (!Manager.HasSuperUserRole) { return(new EmptyResult()); } SendSMS.GetSMSProcessorCondInfo info = await SendSMS.GetSMSProcessorCondAsync(); DisplayModel model = new DisplayModel() { Available = info.Count, TestMode = info.Processor != null ? await info.Processor.IsTestModeAsync() : false, ProcessorName = info.Processor != null ? info.Processor.Name : null, }; if (model.Available == 1 && !model.TestMode) { return(new EmptyResult()); } return(View(model)); }
public async Task <ActionResult> AlertDisplay() { if (Manager.EditMode) { return(new EmptyResult()); } if (Manager.IsInPopup) { return(new EmptyResult()); } bool done = Manager.SessionSettings.SiteSettings.GetValue <bool>("YetaWF_Basics_AlertDone", false); if (done) { return(new EmptyResult()); } using (AlertConfigDataProvider dataProvider = new AlertConfigDataProvider()) { AlertConfig config = await dataProvider.GetItemAsync(); if (config == null || !config.Enabled) { return(new EmptyResult()); } if (config.MessageHandling == AlertConfig.MessageHandlingEnum.DisplayOnce) { Manager.SessionSettings.SiteSettings.SetValue <bool>("YetaWF_Basics_AlertDone", true); Manager.SessionSettings.SiteSettings.Save(); } DisplayModel model = new DisplayModel() { MessageHandling = config.MessageHandling, Message = config.Message, }; return(View(model)); } }
public DotMatrix dotMatrix; // Reference is set in Unity Editor inspector void Start() { // Simple arrows, using 2 colors (1 and 2) in addition to background color (0) int[,] arrowContent = new int[, ] { { 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0, 0 }, { 0, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0 }, { 0, 0, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0 }, { 0, 0, 0, 1, 1, 1, 0, 0, 0, 2, 2, 2 }, { 0, 0, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0 }, { 0, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0 }, { 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0, 0 } }; // Add arrows to display Controller controller = dotMatrix.GetController(); controller.AddCommand(new ContentCommand(arrowContent)); // Cycle all the content on display to right, any dots on rightmost column will appear on leftmost column of display DisplayModel displayModel = dotMatrix.GetDisplayModel(); controller.AddCommand(new CallbackCommand(new Action(delegate() { displayModel.CycleRight(); })) { Repeat = true }); // Take a short break controller.AddCommand(new PauseCommand(0.2f) { Repeat = true }); // Two last commands repeats forever, we are done here }
// GET: Menu #region Page Load public async Task <ActionResult> Index() { Session["selectedmenu"] = "Menu"; ShoppingCartDetail shoppingCartDetail = new ShoppingCartDetail(); HeaderController headerController = new HeaderController(); DisplayModel dt = new DisplayModel(); dt = await DisplayModelList1(); BindCombo(); if (Session["Shoppingcart"] != null) { var calgranttotal = decimal.Parse(Session["GrandTotal"].ToString()); if (Session["deliverytypemenu"] != null) { if (Convert.ToString(Session["deliverytypemenu"]) == "Delivery") { calgranttotal += 25; } } var listshop = (List <ShoppingCartModel>)Session["Shoppingcart"]; shoppingCartDetail.listshoppingItems = listshop; shoppingCartDetail.CartTotal = decimal.Parse(Session["SumTotal"].ToString()); //shoppingCartDetail.GrandCartTotal = decimal.Parse(Session["GrandTotal"].ToString()); shoppingCartDetail.GrandCartTotal = calgranttotal; if (Session["CustSelectedTime"] != null) { shoppingCartDetail.Time = Convert.ToString(Session["CustSelectedTime"]); } shoppingCartDetail.NoofItems = listshop.Sum(item => item.Qty).ToString(); shoppingCartDetail.pagename = "M"; ViewBag.isempty = "N"; } if (shoppingCartDetail.listshoppingItems == null) { ViewBag.isempty = "Y"; } shoppingCartDetail.displayModel = dt; return(View(shoppingCartDetail)); }
public static IEnumerable <Floor> CreateFloors(DisplayModel displayModel) { var levels = displayModel.Spaces .Select(s => s.FloorLevel) .Distinct() .ToList(); levels.Sort(); foreach (var level in levels) { var newFloor = new Floor { Name = $"Floor Z = {level}" }; newFloor.Spaces.AddRange(displayModel.Spaces .Where(s => Math.Abs(s.FloorLevel - level) < MinHeightDifference)); yield return(newFloor); } }
public DisplayModel GetCookie(string name) { HttpCookie cookie = HttpContext.Request.Cookies[name]; DisplayModel DisplayModels = new DisplayModel(); if (cookie != null) { string objCartListString = cookie.Value.ToString(); //string[] objCartListStringSplit = objCartListString.Split('|'); //foreach (string s in objCartListStringSplit) //{ string[] ss = objCartListString.Split(','); if (ss[0] != "") { DisplayModel model = new DisplayModel() { DeliveryCloseMsg = ss[0], DisplayMsgDeliveyClose = ss[1], DisplayMsgOnHome = ss[2], DisplayMsgPickupClose = ss[3], DisplayMsgResClose = ss[4], IsDeliveryAvailable = ss[5], IsPickupAvailable = ss[6], IsRestaurantOpen = ss[7], PickupCloseMsg = ss[8], ResCloseMsg = ss[9], }; DisplayModels = model; } //} } else { DisplayModels = null; } return(DisplayModels); }
public async Task <ActionResult> TinyVisitors() { using (VisitorEntryDataProvider visitorDP = new VisitorEntryDataProvider()) { if (visitorDP.Usable) { string addonUrl = VersionManager.GetAddOnPackageUrl(AreaRegistration.CurrentPackage.AreaName); VisitorEntryDataProvider.Info info = await visitorDP.GetStatsAsync(); DisplayModel model = new DisplayModel { }; model.TodaysAnonymous = info.TodaysAnonymous; model.TodaysUsers = info.TodaysUsers; model.YesterdaysAnonymous = info.YesterdaysAnonymous; model.YesterdaysUsers = info.YesterdaysUsers; model.Tooltip = this.__ResStr("tooltip", "Today: {0} Users, {1} Anonymous - Yesterday: {2}/{3}", model.TodaysUsers, model.TodaysAnonymous, model.YesterdaysUsers, model.YesterdaysAnonymous); model.ImageUrl = addonUrl + "Icons/People.png"; model.VisitorsUrl = Module.VisitorsUrl; return(View(model)); } return(new EmptyResult()); } }
public ActionResult IFrameDisplay() { if (string.IsNullOrWhiteSpace(Module.Url)) { return(new EmptyResult()); } DisplayModel model = new DisplayModel(); model.Style = ""; if (!string.IsNullOrWhiteSpace(Module.Width)) { model.Style += "width:" + Module.Width; } if (!string.IsNullOrWhiteSpace(model.Style)) { model.Style += ";"; } if (!string.IsNullOrWhiteSpace(Module.Height)) { model.Style += "height:" + Module.Height; } return(View(model)); }
private void snapshot() { //ImageSaver.SavedByHandle(DisplayModel.GetSnapshot()); var img = DisplayModel.GetSnapshot(); if (img != null) { string name = DisplayModel.VideoName; if (string.IsNullOrWhiteSpace(name)) { name = "未知视频"; } PreviewWin.Show(img, name); if (SnapshotEvent != null) { SnapshotEvent(); } } else { DialogWin.Show("未获取到视频数据。", DialogWinImage.Information); } }
private void GetResults() { if (!string.IsNullOrEmpty(_queryInput) && !string.IsNullOrWhiteSpace(_queryInput)) { InfoList.Clear(); var query = new Query(); var results = query.GetSearchResult(_queryInput, _selectedEngine); if (results != null && results.Any()) { foreach (var r in results) { var model = new DisplayModel() { RelatedKey = r.RelatedKey, Description = r.Description, Url = r.Url, }; InfoList.Add(model); } NotifyPropertyChanged("InfoList"); SelectedInfo = InfoList.FirstOrDefault(); } } }
public async Task <ActionResult> UsersDisplay(string userName) { using (UserDefinitionDataProvider dataProvider = new UserDefinitionDataProvider()) { UserDefinition user = await dataProvider.GetItemAsync(userName); if (user == null) { throw new Error(this.__ResStr("notFound", "User \"{0}\" not found."), userName); } DisplayModel model = new DisplayModel(); model.SetData(user); using (UserLoginInfoDataProvider userLogInfoDP = new UserLoginInfoDataProvider()) { List <DataProviderFilterInfo> filters = null; filters = DataProviderFilterInfo.Join(filters, new DataProviderFilterInfo { Field = nameof(UserDefinition.UserId), Operator = "==", Value = user.UserId }); DataProviderGetRecords <LoginInfo> list = await userLogInfoDP.GetItemsAsync(0, 0, null, filters); model.LoginProviders = (from LoginInfo l in list.Data select l.LoginProvider).ToList(); } Module.Title = this.__ResStr("modDisplayTitle", "User {0}", userName); return(View(model)); } }
internal DisplayModel Read(XmlNode displayNode) { var theDisplay = new DisplayModel(_workspace.Model); for (var i = 0; i < displayNode.ChildNodes.Count; i++) { var topLevelNode = displayNode.ChildNodes[i]; switch (topLevelNode.Name.ToLower()) { case "bindings": new XmlVisualizerBindingReader(theDisplay).Read(topLevelNode.ChildNodes); break; case "visualizers": new XmlVisualizerReader(theDisplay).Read(topLevelNode.ChildNodes); break; default: throw new NotImplementedException("Unknown top level node."); } } return(theDisplay); }
internal override float runStep(DisplayModel displayModel, float timeToConsume) { if (method == ClearCommand.Methods.Instant) { displayModel.SetAll(targetState); return(timeToConsume); } if (counter < 0) { while (timeToConsume >= secondsPerDot) { if (method == ClearCommand.Methods.MoveLeft) { displayModel.PushLeft(); if (targetState > 0) { displayModel.SetColumn(displayModel.Width - 1, targetState); } } else if (method == ClearCommand.Methods.MoveRight) { displayModel.PushRight(); if (targetState > 0) { displayModel.SetColumn(0, targetState); } } else if (method == ClearCommand.Methods.MoveUp) { displayModel.PushUp(); if (targetState > 0) { displayModel.SetRow(displayModel.Height - 1, targetState); } } else if (method == ClearCommand.Methods.MoveDown) { displayModel.PushDown(); if (targetState > 0) { displayModel.SetRow(0, targetState); } } timeToConsume -= secondsPerDot; if (isFinished(displayModel)) { break; } } } else { while (timeToConsume >= secondsPerDot && counter < counterMax) { if (method == ClearCommand.Methods.ColumnByColumnFromLeft) { displayModel.SetColumn(counter, targetState); } else if (method == ClearCommand.Methods.ColumnByColumnFromRight) { displayModel.SetColumn(displayModel.Width - counter - 1, targetState); } else if (method == ClearCommand.Methods.RowByRowFromTop) { displayModel.SetRow(counter, targetState); } else if (method == ClearCommand.Methods.RowByRowFromBottom) { displayModel.SetRow(displayModel.Height - counter - 1, targetState); } timeToConsume -= secondsPerDot; counter++; } } return(timeToConsume); }
public ActionResult Show() { List <DisplayModel> displayModelList = new List <DisplayModel>(); List <HoldingTable> holdingTableList = db.HoldingTables.ToList(); List <InvestmentTree> investmentTreeList = db.InvestmentTrees.ToList(); List <string> splitTypeList = new List <string>(); List <string> portList = new List <string>(); List <string> mportList = new List <string>(); foreach (InvestmentTree tree in investmentTreeList) { splitTypeList.Add(tree.SplitType); if (tree.SplitType == "Portfolio") { foreach (HoldingTable holdingTable in holdingTableList) { if (portList.IndexOf(holdingTable.PortfolioName) < 0) { portList.Add(holdingTable.PortfolioName); } } } if (tree.SplitType == "Model portfolio") { foreach (HoldingTable holdingTable in holdingTableList) { if (mportList.IndexOf(holdingTable.ModelPortfolioName) < 0) { mportList.Add(holdingTable.ModelPortfolioName); } } } } foreach (string type in splitTypeList) { foreach (string port in portList) { DisplayModel display = new DisplayModel(); display.Name = port; foreach (HoldingTable holdingTable in holdingTableList) { if (holdingTable.PortfolioName == port) { display.Value += holdingTable.MarketValue; } } displayModelList.Add(display); } foreach (string mport in mportList) { DisplayModel display = new DisplayModel(); display.Name = mport; foreach (HoldingTable holdingTable in holdingTableList) { if (holdingTable.PortfolioName == mport) { display.Value += holdingTable.MarketValue; } } displayModelList.Add(display); } } return(View(displayModelList)); }
/// <summary> /// Initializes a new instance of the <see cref="OledDisplaySsd1306"/> class. /// </summary> /// <param name="model">The model.</param> public OledDisplaySsd1306(DisplayModel model) : this(GetDefaultDevice(), model, VccSourceMode.Switching) { // placeholder }
/// <summary> /// Constructs the front end and the internal physics representation of the vehicle. /// </summary> /// <param name="position">Position of the tank.</param> /// <param name="owningSpace">Space to add the vehicle to.</param> /// <param name="cameraToUse">Camera to attach to the vehicle.</param> /// <param name="drawer">Drawer used to draw the tank.</param> /// <param name="wheelModel">Model to use for the 'wheels' of the tank.</param> /// <param name="wheelTexture">Texture of the wheels on the tank.</param> public TankInput(Vector3 position, Space owningSpace, Camera cameraToUse, ModelDrawer drawer, Model wheelModel, Texture2D wheelTexture) { var bodies = new List <CompoundShapeEntry>() { new CompoundShapeEntry(new BoxShape(4f, 1, 8), new Vector3(0, 0, 0), 500), new CompoundShapeEntry(new BoxShape(3, .7f, 4f), new Vector3(0, .5f + .35f, .5f), 1) }; var body = new CompoundBody(bodies, 501); body.CollisionInformation.LocalPosition = new Vector3(0, -.5f, 0); body.Position = (position); //At first, just keep it out of the way. Vehicle = new Vehicle(body); #region RaycastWheelShapes //The wheel model used is not aligned initially with how a wheel would normally look, so rotate them. MaximumDriveForce = 1800; BaseSlidingFriction = 7; Matrix wheelGraphicRotation = Matrix.CreateFromAxisAngle(Vector3.Forward, MathHelper.PiOver2); for (int i = 0; i < 6; i++) { var toAdd = new Wheel( new RaycastWheelShape(.375f, wheelGraphicRotation), new WheelSuspension(2000, 300f, Vector3.Down, 1.3f, new Vector3(-1.9f, 0, -2.9f + i * 1.15f)), new WheelDrivingMotor(10, MaximumDriveForce, MaximumDriveForce), new WheelBrake(BaseSlidingFriction, BaseSlidingFriction, 1.0f), new WheelSlidingFriction(3.5f, 3.5f)); Vehicle.AddWheel(toAdd); leftTrack.Add(toAdd); } for (int i = 0; i < 6; i++) { var toAdd = new Wheel( new RaycastWheelShape(.375f, wheelGraphicRotation), new WheelSuspension(2000, 300f, Vector3.Down, 1.3f, new Vector3(1.9f, 0, -2.9f + i * 1.15f)), new WheelDrivingMotor(10, 2000, 1000), new WheelBrake(BaseSlidingFriction, BaseSlidingFriction, 1.0f), new WheelSlidingFriction(3.5f, 3.5f)); Vehicle.AddWheel(toAdd); rightTrack.Add(toAdd); } #endregion foreach (Wheel wheel in Vehicle.Wheels) { //This is a cosmetic setting that makes it looks like the car doesn't have antilock brakes. wheel.Shape.FreezeWheelsWhileBraking = true; //By default, wheels use as many iterations as the space. By lowering it, //performance can be improved at the cost of a little accuracy. wheel.Suspension.SolverSettings.MaximumIterations = 1; wheel.Brake.SolverSettings.MaximumIterations = 1; wheel.SlidingFriction.SolverSettings.MaximumIterations = 1; wheel.DrivingMotor.SolverSettings.MaximumIterations = 1; } Space = owningSpace; Space.Add(Vehicle); ModelDrawer = drawer; DisplayModel model; WheelModels = new List <DisplayModel>(); for (int k = 0; k < Vehicle.Wheels.Count; k++) { Vehicle.Wheels[k].Shape.Detector.Tag = "noDisplayObject"; model = new DisplayModel(wheelModel, ModelDrawer); ModelDrawer.Add(model); WheelModels.Add(model); model.Texture = wheelTexture; } Camera = cameraToUse; }
/// <summary> /// Applies a given ModDisplay to this DisplayModel /// </summary> /// <typeparam name="T">The type of ModDisplay</typeparam> public static void ApplyDisplay <T>(this DisplayModel displayModel) where T : ModDisplay { ModContent.GetInstance <T>().Apply(displayModel); }