public override void Render(FrameModel frameModel, bool keyboardOnly) { if (Settings.IsEnabled) { base.Render(frameModel, keyboardOnly); } }
public void DrawFrame(FrameModel frameModel) { // No point updating the display if the view isn't visible if (!IsActive) { return; } // Only update keyboard if there is an active keyboard if (_deviceManager.ActiveKeyboard != null) { var rect = _deviceManager.ActiveKeyboard.KeyboardRectangle(1); Keyboard = ImageUtilities.BitmapToDrawingImage(frameModel.KeyboardBitmap, rect); } if (frameModel.MouseBitmap != null) { Mouse = ImageUtilities.BitmapToDrawingImage(frameModel.MouseBitmap, new Rect(0, 0, 10, 10)); } if (frameModel.HeadsetBitmap != null) { Headset = ImageUtilities.BitmapToDrawingImage(frameModel.HeadsetBitmap, new Rect(0, 0, 10, 10)); } if (frameModel.MousematBitmap != null) { Mousemat = ImageUtilities.BitmapToDrawingImage(frameModel.MousematBitmap, new Rect(0, 0, 10, 10)); } if (frameModel.GenericBitmap != null) { Generic = ImageUtilities.BitmapToDrawingImage(frameModel.GenericBitmap, new Rect(0, 0, 10, 10)); } }
public RayTracer(int x, int y) { Frame = new FrameModel(x, y); // initialise the scene with objects SceneObjects = new List <I3dObject>(); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext == null) { throw new ArgumentNullException(nameof(filterContext)); } var inherit = true; if (!filterContext.ActionDescriptor.IsDefined(typeof(AllowAnonymousAttribute), inherit) && !filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(AllowAnonymousAttribute), inherit)) { if (CurrentUser == null) { //无效用户 filterContext.Result = View("_NoPower"); } } if (null != CurrentUser) { var controllerName = filterContext.RouteData.Values["controller"].ToString(); var model = new FrameModel() { CurrentUser = CurrentUser }; var siteInfo = new SiteInfo() { Name = "精准站外流量推广", Company = "一七互动网络有限公司" }; model.Navs = _navBll.Value.GetNavList(CurrentUser.Id); model.Site = siteInfo; ViewBag.Farame = model; } }
/// <summary> /// Inicializa la figura /// </summary> public void InitShape(FrameModel frame, string languageSelected, string languageDefault) { // Asigna el borde del control if (frame.Shape != null) { Border = new ComicShapeView(frame.Shape); } else { Border = new Rectangle(); if (frame.RadiusX != null) { (Border as Rectangle).RadiusX = frame.RadiusX ?? 0; } if (frame.RadiusY != null) { (Border as Rectangle).RadiusY = frame.RadiusY ?? 0; } } Border.Stretch = Stretch.Fill; // Asigna el fondo Border.Fill = ViewTools.GetBrush(frame, frame.Brush); // Asigna el borde ViewTools.AssignPen(Border, frame.Pen); // Añade la figura al canvas Children.Add(Border); // Asigna la posición a la figura Grid.SetRow(Border, 0); Grid.SetColumn(Border, 0); // Añade los textos InitTexts(frame, languageSelected, languageDefault); }
public FrameViewModel() { _model = new FrameModel(); Games = new ObservableCollection <GameButton>(); _model.GameAdded += new EventHandler <GameAddedEventArgs>(model_gameAdded); _model.init(); }
public async void Load() { Frames = new ObservableCollection <FrameModel>(await _frameService.GetAll()); Devices = new ObservableCollection <DeviceModel>(await _deviceService.GetAll()); SelectedFrame = new FrameModel(); SelectedFrame.RunValidation = Save.RaiseCanExecuteChanged; }
public Message CreateUpdateFrameIdMessage(FrameModel frame, byte newFrameId) { return(new Message( 0x3C, Direction.Publisher, ChecksumType.Classic, InsertFrameId(frame, newFrameId))); }
public Message CreateReadByIdMessage(FrameModel frame) { return(new Message( 0x3C, Direction.Publisher, ChecksumType.Classic, frame.LegacyCommandBytes)); }
public Message CreateUpdateFrameIdMessage(FrameModel frame, byte newFrameId) { return(new Message( 0x3C, Direction.Publisher, ChecksumType.Classic, new byte[] { 0x7F, 0x06, 0xB7, 0x02, newFrameId, 0xFF, 0xFF, 0xFF })); }
public Message CreateReadByIdMessage(FrameModel frame) { return(new Message( 0x3C, Direction.Publisher, ChecksumType.Classic, new byte[] { 0x7F, 0x06, 0xB2, 0x00, 0xFF, 0x7F, 0xFF, 0xFF })); }
public override void Render(FrameModel frameModel, bool keyboardOnly) { var c = frameModel.KeyboardModel.GetDrawingContext(); foreach (var bubble in _bubbles) { bubble.Draw(c); } }
public static void SetFrameDesginByFrameModel(FrameModel frameModel) { //比例尺; FrameDesign.CorTxtColor = frameModel.ScaleValueColor; FrameDesign.CorTxtFont = frameModel.ScaleValueFont; FrameDesign.CorTxtHeit = StrUtil.StrToDouble(frameModel.ScaleValueHeight, 8, "比例尺文本高度为非数值型"); FrameDesign.CorValue = frameModel.ScaleValue; FrameDesign.XCoordinate = StrUtil.StrToDouble(BiLiChiOper.GetXValueStr(frameModel.ScaleValue), "比例尺X值为空", "比例尺X值为非数值型"); FrameDesign.YCoordinate = StrUtil.StrToDouble(BiLiChiOper.GetYValueStr(frameModel.ScaleValue), "比例尺X值为空", "比例尺X值为非数值型"); //图例设计 FrameDesign.LegendPos = frameModel.LegendPos; //图例设计位置 FrameDesign.LegendStyle = frameModel.LegendStyle; //图例设计类型 FrameDesign.LegendColumnNum = StrUtil.StrToInt(frameModel.LegendColumnNum, 5, ""); //图例设计列数 FrameDesign.LegendUnitHeigh = StrUtil.StrToDouble(frameModel.LegendUnitHeigh, 10, "图例设计单位高度为非数值型"); //图例设计单位高度 FrameDesign.LegendTbAndField = frameModel.LegendTbAndField; //获得图例查询所涉及的表和字段; FrameDesign.IfAddLegend = BoolUtil.GetBoolByBindID(frameModel.IfAddLegend, true); // BoolUtil.GetBoolBySFStr(frameModel.IfAddLegend,true); //绘图项文字; if (!string.IsNullOrEmpty(frameModel.PictureItemFont)) { FrameDesign.PictureItemFont = frameModel.PictureItemFont; } if (!string.IsNullOrEmpty(frameModel.PictureItemTxtHeight)) { FrameDesign.PictureItemTxtHeight = StrUtil.StrToDouble(frameModel.PictureItemTxtHeight, 4, "绘图项文字的高度为非数值型"); } //图幅设计 FrameDesign.JdSpace = StrUtil.StrToDouble(frameModel.JDSpace, 20, "井段间距为非数值型"); FrameDesign.PictureFrameLineWidth = StrUtil.StrToDouble(frameModel.PictureFrameLineWidth, "缺少外框线宽", "外框线宽为非数值型"); //外框线宽 FrameDesign.LineRoadTitleBarHeigh = StrUtil.StrToDouble(frameModel.LineRoadTitleBarHeigh, "缺少线道标题栏高度", "线道标题栏高度为非数值型"); //线道标题栏高度 //刻度尺 if (!string.IsNullOrEmpty(frameModel.ScaleLabelTxtFont)) { FrameDesign.ScaleLabelTxtFont = frameModel.ScaleLabelTxtFont; } if (!string.IsNullOrEmpty(frameModel.ScaleLabelTxtHeight)) { FrameDesign.ScaleLabelTxtHeight = frameModel.ScaleLabelTxtHeight; } //图头文字 FrameDesign.HeaderContent = frameModel.PictureHeaderName; FrameDesign.PictureHeaderTXTStyle = frameModel.PictureHeaderTXTStyle; FrameDesign.HeadBigTxtHeight = StrUtil.StrToDouble(frameModel.HeadBigTxtHeight, 18, "图头字高为非数值型"); FrameDesign.HeaderTxtColor = frameModel.HeadBigTxtColor; }
private static byte[] InsertFrameId(FrameModel frame, byte newFrameId) { var bytes = frame.LegacyCommandBytes.ToList(); bytes.RemoveAt(frame.LegacyCommandBytes.Length - 1); bytes.Add(newFrameId); return(bytes.ToArray()); }
public static ObservableCollection <Command> CreateCommands(FrameModel frame) { if (frame.Device.IncludeSaveConfig) { return(CommandProvider.CreateCommands(frame)); } return(LegacyCommandProvider.CreateCommands(frame)); }
/// <summary> /// Añade un frame a la página /// </summary> private void AddFrame(FrameModel shape) { ComicFrameView view = new ComicFrameView(); // Carga la figura view.InitShape(shape, LanguageSelected, LanguageDefault); // Añade el control AddControl(view, shape); }
public Task SendDeviceSpecificFrame(FrameModel frame) { return(Task.Run(() => { var messageProvider = MessageProviderFactory.Create(frame.Device.IncludeSaveConfig); var message = messageProvider.CreateMessageFor(frame); _linProvider.Send(message); })); }
public override void Render(FrameModel frameModel, bool keyboardOnly) { using (var g = Graphics.FromImage(frameModel.KeyboardBitmap)) { foreach (var bubble in _bubbles) { bubble.Draw(g); } } }
public static ObservableCollection <Command> CreateCommands(FrameModel frame) { var assignFrameIdRange = CreateAssignFrameIdCommand(frame); var readById = CreateReadByIdCommand(); return(new ObservableCollection <Command> { readById, assignFrameIdRange }); }
public Task ReadById(FrameModel frame) { return(Task.Run(() => { var messageProvider = MessageProviderFactory.Create(frame.Device.IncludeSaveConfig); var message = messageProvider.CreateReadByIdMessage(frame); _linProvider.Send(message); _linProvider.Send(messageProvider.CreateSubscriberMessage()); })); }
public async Task Update(FrameModel model) { var entity = await _db.Frames .SingleOrDefaultAsync(x => x.Id == model.Id); if (entity != null) { _mapper.Map(model, entity); } await _db.SaveChangesAsync(); }
/// <summary> /// Inicializa los textos /// </summary> private void InitTexts(FrameModel frame, string languageSelected, string languageDefault) { foreach (TextModel text in frame.Texts) { TextFormattedGeometry textGeometry = new TextFormattedGeometry(); // Asigna las propiedades textGeometry.InitView(text, text.Texts.GetText(languageSelected, languageDefault)); // Añade el texto al control Children.Add(textGeometry); } }
public async Task <FrameModel> Create(FrameModel model) { var entity = new Frame(); _mapper.Map(model, entity); _db.Frames.Add(entity); await _db.SaveChangesAsync(); model.Id = entity.Id; return(model); }
/// <summary> /// Carga el contenido de un bocadillo /// </summary> private void LoadBalloonContent(FrameModel objBalloon, MLNode nodeML) { foreach (MLNode childML in nodeML.Nodes) { switch (childML.Name) { case ComicRepositoryConstants.TagText: objBalloon.Texts.Add(LoadText(objBalloon.Page, objBalloon, childML)); break; } } }
public async Task Update(FrameModel model) { await _db.Load(); var entities = _db.Collection .FramesById(model.Id) .ToList(); entities.ForEach(x => x.Update(model)); await _db.Save(); }
/// <summary> /// Carga el contenido de un texto /// </summary> private TextModel LoadText(PageModel page, FrameModel parent, MLNode nodeML) { TextModel text = new TextModel(page, nodeML.Attributes[ComicRepositoryConstants.TagKey].Value); // Asigna los parámetros básicos Mediator.CommonRepository.AssignAttributesPageItem(nodeML, text); // Obtiene los valores del nodo text.IsBold = nodeML.Attributes[ComicRepositoryConstants.TagBold].Value.GetBool(); text.IsItalic = nodeML.Attributes[ComicRepositoryConstants.TagItalic].Value.GetBool(); text.FontName = nodeML.Attributes[ComicRepositoryConstants.TagFont].Value; text.Size = nodeML.Attributes[ComicRepositoryConstants.TagSize].Value.GetDouble(10); text.Color = new ColorModel(nodeML.Attributes[ComicRepositoryConstants.TagColor].Value); // Asigna el contenido if (nodeML.Nodes.Count != 0) { // Asigna el texto foreach (MLNode childML in nodeML.Nodes) { switch (childML.Name) { case ComicRepositoryConstants.TagContent: text.Texts.Add(LoadText(childML.Attributes[ComicRepositoryConstants.TagLanguage].Value, childML.Value)); break; case ComicRepositoryConstants.TagTransform: text.Transforms.AddRange(Mediator.TransformRepository.LoadTransforms(childML)); break; } } } else { text.Texts.Add(LoadText("", nodeML.Value)); } // Asigna las dimensiones if (parent != null) { // Asigna el ancho if (text.Dimensions.Width == null) { text.Dimensions.Width = parent.Dimensions.WidthDefault - text.Dimensions.LeftDefault; } // Asigna el alto if (text.Dimensions.Height == null) { text.Dimensions.Height = parent.Dimensions.HeightDefault - text.Dimensions.TopDefault; } } // Devuelve el texto return(text); }
public async Task <FrameModel> Create(FrameModel model) { await _db.Load(); model.Id = _db.Collection.Frames().Max(x => x.Id) + 1; var devices = _db.Collection .DevicesById(model.DeviceId) .ToList(); devices.ForEach(x => x.Frames.Add(model)); await _db.Save(); return(model); }
public void OnRedrawSelectedFrame(FrameModel e, EditorSettingsControl editor) { Clear(); var frm = e?.Bitmap; if (frm != null) { frm = frm.Apply(new IFilter[] { new BrightnessFilter(editor.GameBrightnessMultiplier) }); } Attach(pictureBox1, e?.Bitmap, true); Attach(pictureBox3, e?.Bitmap, true); Attach(pictureBox2, frm, true); Attach(pictureBox4, frm, true); }
private void SetFramec(object obj) { if (SelectedFrame != null) { Bitmap b = new Bitmap(Images.Instance.CurrentBitmap.Width, Images.Instance.CurrentBitmap.Height); using (Graphics g = Graphics.FromImage((System.Drawing.Image)b)) { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; g.DrawImage(SelectedFrame.Frame, 0, 0, Images.Instance.CurrentBitmap.Width, Images.Instance.CurrentBitmap.Height); } SelectedFrame = new FrameModel(b); Images.Instance.Frame = SelectedFrame; Images.Instance.NotifyImages(); VisibilityProperties.Instance.FrameVisibility = true; VisibilityProperties.Instance.NotifyProperties(); } }
private static Command CreateAssignFrameIdCommand(FrameModel frame) { return(new Command { Name = "Assign frame ID", Description = "Updates frame ID to avoid possible conflicts due to same IDs on multiple devices", Type = CommandType.AssignId, Version = 0, Signals = new List <Signal> { new Signal("NAD") { Value = 0x7F }, new Signal("Protocol Control Information") { Value = 0x06 }, new Signal("Service Identifier") { Value = 0xB1 }, new Signal("Supplier ID LSB") { Value = 0xFF }, new Signal("Supplier ID MSB") { Value = 0x7F }, new Signal("Message ID LSB") { Value = 0xFF, IsEnabled = true }, new Signal("Message ID MSB") { Value = 0xFF, IsEnabled = true }, new Signal("PID") { Value = frame.FrameId, IsEnabled = true, CheckRange = true, MinValue = 0x00, MaxValue = 0x3B } } }); }
/// <summary> /// Parse ID3 tags from stream and calculate where the audio must be /// </summary> /// <remarks> /// if this throws an exception, the File is not usable. /// </remarks> private void Initialise() { // create an empty framemodel, to use if we don't parse anything better FrameModel tagModel = new FrameModel(); // clear out any previous taghandler _tagHandler = null; // don't know how big the audio is until we've parsed the tags _audio = null; UInt32 audioNumBytes; using (FileStream sourceStream = _sourceFileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.Read)) { // all the header calculations use UInt32; // this guarantees all the file offsets we have to deal with fit in a UInt32 if (sourceStream.Length > UInt32.MaxValue) throw new InvalidAudioFrameException("MP3 file can't be bigger than 4gb"); // in the absence of any recognised tags, // audio starts at the start _audioStart = 0; // audio is entire file length audioNumBytes = (UInt32)sourceStream.Length; // try to read an ID3v1 block. // If ID3v2 block exists, its values overwrite these // Otherwise, if ID3V1 block exists, its values are used // The audio is anything that's left after all the tags are excluded. try { ID3v1 id3v1 = new ID3v1(); id3v1.Deserialize(sourceStream); // fill in ID3v2 block from the ID3v1 data tagModel = id3v1.FrameModel; // audio is shorter by the length of the id3v1 tag audioNumBytes -= ID3v1.TagLength; } catch (TagNotFoundException) { // ignore "no ID3v1 block" // everything else isn't caught here, and throws out to the caller } try { sourceStream.Seek(0, SeekOrigin.Begin); tagModel = FrameManager.Deserialize(sourceStream); // audio starts after the tag _audioStart = (uint)sourceStream.Position; // audio is shorter by the length of the id3v2 tag audioNumBytes -= _audioStart; } catch (TagNotFoundException) { // ignore "no ID3v2 block" // everything else isn't caught here, and throws out to the caller } // create a taghandler to hold the tagmodel we've parsed, if any _tagHandler = new TagHandler(tagModel); } // closes sourceStream // save the location of the audio in the original file // passing in audio size and id3 length tag (if any) to help with bitrate calculations _audio = new AudioFile(_sourceFileInfo, _audioStart, audioNumBytes, _tagHandler.Length); _audioReplaced = false; }