/// <summary> /// Registers a menu for the application. NOTE: MenuInfo.MenuItem and MenuInfo.ToolStrip will not be valid.</summary> /// <param name="info">Menu description; standard menus are defined as static members on the MenuInfo class</param> public void RegisterMenu(Sce.Atf.Applications.MenuInfo info) { if (m_commandService == null) throw new InvalidOperationException("ICommandService not found"); m_commandService.RegisterMenu(new MenuDef(info.MenuTag, info.MenuText, info.Description)); }
public EnrollmentCtrl(EnrollmentScope scope, EnrollmentService service, Sce sce) : base(scope, service, sce) { this.scope = scope; this.service = service; this.scope.courseList = new List <Course>(); this.scope.studentList = new List <Student>(); scope.gridOpts.columnDefs = new List <ColumnDef> { new ColumnDef { name = "AC", width = 50, enableSorting = false, cellTemplate = "<div style='text-align:center'><a ng-click=\"getExternalScopes().EditAction(row)\" href=\"javascript:;\"> <i class=\"fa fa-pencil\"></i> </a><a ng-click=\"getExternalScopes().RemoveAction(row)\" href=\"javascript:;\"> <i class=\"fa fa-trash\"></i> </a></div>" } , new ColumnDef { name = "Course", field = "Course_Title" } , new ColumnDef { name = "Student", field = "Student_FirstName" } , new ColumnDef { name = "Grade" } }; scope.gridOpts.onRegisterApi = gridApi => { gridApi.paging.on.pagingChanged(scope, (newPage, pageSize) => { this.pageNo = newPage; this.pageSize = pageSize; this.GetPaged(); }); }; this.GetPaged(); this.LoadRelationalData(); }
public StudentCtrl(StudentScope scope, StudentService service, Sce sce) : base(scope, service, sce) { this.scope = scope; this.service = service; scope.gridOpts.columnDefs = new List <ColumnDef> { new ColumnDef { name = "AC", width = 50, enableSorting = false, cellTemplate = "<div style='text-align:center'><a ng-click=\"getExternalScopes().EditAction(row)\" href=\"javascript:;\"> <i class=\"fa fa-pencil\"></i> </a><a ng-click=\"getExternalScopes().RemoveAction(row)\" href=\"javascript:;\"> <i class=\"fa fa-trash\"></i> </a></div>" } , new ColumnDef { name = "LastName" } , new ColumnDef { name = "FirstName" } , new ColumnDef { name = "EnrollmentDate", cellFilter = "jwtDate | date:'yyyy-MM-dd'" } }; scope.gridOpts.onRegisterApi = gridApi => { gridApi.paging.on.pagingChanged(scope, (newPage, pageSize) => { this.pageNo = newPage; this.pageSize = pageSize; this.GetPaged(); }); }; this.GetPaged(); this.LoadRelationalData(); }
public static float GetAngle( Sce.PlayStation.Core.Vector2 p1, Sce.PlayStation.Core.Vector2 p2, bool degrees=false ) { var x = p2.X - p1.X; var y = p2.Y - p1.Y; if ( x == 0.0f && y == 0.0f ) { return 0.0f; } var c1 = 3.14159265f * 0.25f; var c2 = 3.0f * c1; var ay = y < 0 ? -y : y; var angle = 0.0f; if ( x >= 0 ) { angle = c1 - c1 * ((x - ay) / (x + ay)); } else { angle = c2 - c1 * ((x + ay) / (ay - x)); } angle = y < 0 ? -angle : angle; if ( angle > 2 * c1 ) { angle -= 2 * c2; } else { angle += 2 * c1; } if (degrees) { angle *= 57.2957796f; } return angle; }
public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState state) { // if (commandTag is Command) // { // switch ((Command)commandTag) // { // } // } }
private void ComputeCxf() { //计算雷诺数 double Re = density * speed * length / Viscosity; //计算大头母线长度 L1 = Diameter * headlength / (Diameter - headDim); double L = Math.Sqrt(L1 * L1 + this.R * this.R); //计算小头母线长度 double LL; if (rbtZhui.Checked) { LL = Math.Sqrt((L1 - headlength - headR) * (L1 - headlength - headR) + headR * headR); } else { LL = Math.Sqrt((L1 - headlength) * (L1 - headlength) + headR * headR); } //计算尾椎大母线 rearL1 = Diameter * rearLength / (Diameter - rearDim); double rearL = Math.Sqrt(rearL1 * rearL1 + this.R * this.R); //计算尾椎小母线 double rearLL = Math.Sqrt((rearL1 - headlength) * (rearL1 - headlength) + rearR * rearR); //计算侧面积 double Sce; if (rbtZhui.Checked) { //计算小头母线长度 Sce = (PI * this.R * L - PI * headR * LL) //锥台侧面积 + PI * Diameter * bodylength //圆柱侧面积 + (PI * R * rearL - PI * rearR * rearLL); //尾椎台侧面积 } else { Sce = 0.5 * PI * headDim * headDim //顶半球面积 + (PI * this.R * L - PI * headR * LL) //锥台侧面积 + PI * Diameter * bodylength //圆柱侧面积 + (PI * R * rearL - PI * rearR * rearLL); //尾椎台侧面积 } //计算截面积 double Sjie = R * R * PI; //计算摩阻系数_dan Cxf = 0.032 * (Sce / Sjie) / (Math.Pow(Re, 0.145) * Math.Sqrt(1 + 0.12 * Math.Pow(Ma, 2))); this.txtRe.Text = Re.ToString(); this.txtSce.Text = Sce.ToString(); this.txtSjie.Text = Sjie.ToString(); this.txtSceSjie.Text = (Sce / Sjie).ToString(); this.txtCxf.Text = Cxf.ToString(); }
/// <summary> /// Adds an item to the palette in the given category</summary> /// <param name="item">Palette item</param> /// <param name="categoryName">Category name</param> /// <param name="client">Client that instantiates item during drag-drop operations</param> public void AddItem(object item, string categoryName, Sce.Atf.Applications.IPaletteClient client) { if (m_objectClients.ContainsKey(item)) throw new InvalidOperationException("duplicate item"); m_objectClients.Add(item, client); PaletteContent palette = m_controlInfo.Content as PaletteContent; if (palette != null) { palette.AddItem(item, categoryName ?? string.Empty); } }
/// <summary> /// Registers a control with the control host service</summary> /// <param name="controlHostService">Control host service</param> /// <param name="control">Control</param> /// <param name="name">Control name</param> /// <param name="description">Control description</param> /// <param name="group">Initial location of control on main form</param> /// <param name="id">Unique ID for control</param> /// <param name="client">Client that owns control, or null</param> /// <returns>IControlInfo for registered control</returns> public static IControlInfo RegisterControl( this IControlHostService controlHostService, object control, string name, string description, Sce.Atf.Applications.StandardControlGroup group, string id, IControlHostClient client) { var def = new ControlDef() { Name = name, Description = description, Group = group, Id = id }; return controlHostService.RegisterControl(def, control, client); }
/// <summary>Director constructor.</summary> Director( uint sprites_capacity, uint draw_helpers_capacity, Sce.PlayStation.Core.Graphics.GraphicsContext context ) { m_paused = false; m_frame_timer = new Timer(); m_run_with_scene_called = false; m_elapsed = 0.0; GL = new GraphicsContextAlpha( context ); DrawHelpers = new DrawHelpers( GL, draw_helpers_capacity ); SpriteRenderer = new SpriteRenderer( GL, 6 * sprites_capacity ); //DebugFlags |= GameEngine2D.DebugFlags.Log; m_canceled_replace_scene = new HashSet< Scene >(); }
public ControlInfo(string name, string description, string id, Sce.Atf.Applications.StandardControlGroup group, object imageKey, IDockContent dockContent, IControlHostClient client) { Requires.NotNullOrEmpty(id, "id"); Requires.NotNull(dockContent, "dockContent"); Requires.NotNull(client, "client"); DockContent = dockContent; dockContent.PropertyChanged += DockContent_PropertyChanged; Name = name; Description = description; Id = id; Group = group; ImageSourceKey = imageKey; Client = client; }
/// <summary> /// Registers the control and adds it to a visible form</summary> /// <param name="control">Control</param> /// <param name="controlInfo">Control display information</param> /// <param name="client">Client that owns the control and receives notifications /// about its status, or null if no notifications are needed</param> /// <remarks>If IControlHostClient.Close() has been called, the IControlHostService /// also calls UnregisterControl. Call RegisterControl again to re-register the Control.</remarks> public void RegisterControl(System.Windows.Forms.Control control, Sce.Atf.Applications.ControlInfo controlInfo, Sce.Atf.Applications.IControlHostClient client) { var clientAdapter = GetOrCreateClientAdapter(client); // WPF control host service requires a unique control ID in order to be able to reload window layouts // on app startup. // This is a problem as we do not have one here. // The best we can do is try and generate a unique hash int uniqueId = GenerateId(control, controlInfo, client); IControlInfo contentInfo = m_adaptee.RegisterControl(control, controlInfo.Name, controlInfo.Description, controlInfo.Group, uniqueId.ToString(), clientAdapter); controlInfo.Control = control; m_info.Add(controlInfo, contentInfo); TransferControlInfoValues(controlInfo); controlInfo.Changed += (s, e) => TransferControlInfoValues(s as Sce.Atf.Applications.ControlInfo); }
/// <summary>GraphicsContextAlpha constructor.</summary> public GraphicsContextAlpha( Sce.PlayStation.Core.Graphics.GraphicsContext context = null ) { m_context = context; m_context_must_be_disposed = false; if ( m_context == null ) { m_context = new Sce.PlayStation.Core.Graphics.GraphicsContext(); m_context_must_be_disposed = true; // this class takes ownership of m_context } ModelMatrix = new MatrixStack(16); ViewMatrix = new MatrixStack(16); ProjectionMatrix = new MatrixStack(8); m_white_texture = CreateTextureUnicolor( 0xffffffff ); m_white_texture_info = new TextureInfo( m_white_texture ); DebugStats = new DebugStats_(); }
/// <summary> /// Registers a command for a command client. /// NOTE: CommandInfo.MenuItem and CommandInfo.Button will not be valid. /// Shortcut related properties and methods on CommandInfo will have no effect.</summary> /// <param name="info">Command description; standard commands are defined as static /// members on the CommandInfo class</param> /// <param name="client">Client that handles the command</param> public void RegisterCommand(Sce.Atf.Applications.CommandInfo info, Sce.Atf.Applications.ICommandClient client) { // Embedded image resources will not be available as WPF app resources // If image resource does not exist we need to create it and add it to app resources object imageResourceKey = null; if (!string.IsNullOrEmpty(info.ImageName)) { var embeddedImage = ResourceUtil.GetImage(info.ImageName); if (embeddedImage == null) throw new InvalidOperationException("Could not find embedded image: " + info.ImageName); Util.GetOrCreateResourceForEmbeddedImage(embeddedImage); imageResourceKey = embeddedImage; } // Convert text and path string displayText = GetDisplayMenuText(info.MenuText); info.DisplayedMenuText = displayText; string[] menuPath = GetMenuPath(info.MenuText); // Convert shortcuts var inputGestures = new List<InputGesture>(); foreach (var formsKey in info.Shortcuts) inputGestures.Add(Util.ConvertKey(formsKey)); // Create and register command passing this as command client var def = new CommandDef( info.CommandTag, info.MenuTag, info.GroupTag, displayText, menuPath, info.Description, imageResourceKey, inputGestures.ToArray<InputGesture>(), info.Visibility); var clientAdapter = GetOrCreateClientAdapter(client); var command = m_commandService.RegisterCommand(def, clientAdapter); clientAdapter.AddCommand(command); }
public BaseController(IBaseScope <T> scope, BaseService <T> service, Sce sce) { this.scope = scope; this.service = service; this.sce = sce; this.scope.message = null; this.scope.list = null; this.scope.gridOpts = new GridOptions { data = "list", pagingPageSize = this.pageSize, pagingPageSizes = new List <int> { 10, 15, 20, 30, 50, 100, 500, 1000 }, useExternalPaging = true }; this.scope.isGrid = false; this.scope.gridAction = new GridActionExternalScope { EditAction = row => { this.scope.model = this.OnPreLoadForm(row.entity); this.scope.isGrid = true; this.isNewItem = false; }, RemoveAction = row => { if (confirm("Are you sure?")) { this.Delete(row.entity); } } }; /*$ * this.scope.model ={ }; * this.scope.TrustAsHtml=this.TrustAsHtml.bind(this); * this.scope.createNewItem=this.createNewItem.bind(this); * this.scope.submitForm=this.submitForm.bind(this); * toastr.options.extendedTimeOut = 1000; * toastr.options.timeOut = 1000; * toastr.options.fadeOut = 250; * toastr.options.fadeIn = 250; * toastr.options.positionClass = "toast-top-center"; * $*/ }
public static int IncrementTile(Sce.PlayStation.HighLevel.GameEngine2D.SpriteTile sprite, int steps, int min, int max, bool looping) { int x = sprite.TextureInfo.NumTiles.X; int y = sprite.TextureInfo.NumTiles.Y; int current = sprite.TileIndex2D.X + sprite.TileIndex2D.Y * x; if (looping) { current -= min; current += steps; current %= max - min; current += min; } else { current += steps; current = System.Math.Min(current, max - 1); } sprite.TileIndex1D = current; return current; }
public ControlInfo(string name, string description, string id, Sce.Atf.Applications.StandardControlGroup group, IDockContent dockContent, IControlHostClient client) : this(name, description, id, group, null, dockContent, client) { }
private ControlHostClientAdapter GetOrCreateClientAdapter(Sce.Atf.Applications.IControlHostClient client) { ControlHostClientAdapter adapter; if (!m_clientAdapters.TryGetValue(client, out adapter)) { adapter = new ControlHostClientAdapter(client); m_clientAdapters.Add(client, adapter); } return adapter; }
private static DockTo ControlGroupToDockTo(Sce.Atf.Applications.StandardControlGroup standardControlGroup) { DockTo dockTo = DockTo.Top; switch (standardControlGroup) { case Sce.Atf.Applications.StandardControlGroup.Bottom: dockTo = DockTo.Bottom; break; case Sce.Atf.Applications.StandardControlGroup.Center: dockTo = DockTo.Center; break; case Sce.Atf.Applications.StandardControlGroup.CenterPermanent: dockTo = DockTo.Center; break; case Sce.Atf.Applications.StandardControlGroup.Floating: dockTo = DockTo.Center; break; case Sce.Atf.Applications.StandardControlGroup.Left: dockTo = DockTo.Left; break; case Sce.Atf.Applications.StandardControlGroup.Right: dockTo = DockTo.Right; break; case Sce.Atf.Applications.StandardControlGroup.Top: dockTo = DockTo.Top; break; } return dockTo; }
public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState commandState) { throw new InvalidOperationException("CommandClientAdapter.UpdateCommand() - WPF shouldn't ever be calling this method, and suggests a non-WPF app is erroneously using CommandClientAdapter."); }
/// <summary> /// By default, Sce.PlayStation.HighLevel.GameEngine2D.Base.Input2 simply gets the input data automatically, but /// you can override this behaviour and manually set the data. If the data you set has the .Skip flag set /// to true, all touch and button input will be ignored in Sce.PlayStation.HighLevel.GameEngine2D.Base.Input2. /// Calling SetData once forever enables the manual/external control behavior. /// </summary> public void SetData(Sce.PlayStation.Core.Input.GamePadData data) { m_external_control = true; m_external_data = data; }
public static void Initialize(Sce.PlayStation.Core.Graphics.GraphicsContext graphics, Type type) { VFS.BaseType = type; Texture.graphics = graphics; VertexBuffer.graphics = graphics; }
/// <summary> /// Initialize GameEngine2D /// </summary> /// <param name="sprites_capacity">The maximum number of sprites, passed to SpriteRenderer's constructor.</param> /// <param name="draw_helpers_capacity">The maximum number of vertices that we can use in DrawHelpers.</param> /// <param name="context">The core graphics context.</param> public static void Initialize( uint sprites_capacity = 500, uint draw_helpers_capacity = 400, Sce.PlayStation.Core.Graphics.GraphicsContext context = null ) { m_instance = new Director( sprites_capacity, draw_helpers_capacity, context ); Scheduler.m_instance = new Scheduler(); ActionManager.m_instance = new ActionManager(); }
private void RenderCallback(DesignView designView, Sce.Atf.Rendering.Camera camera) {}
private void RenderExtras(DesignView designView, Sce.Atf.Rendering.Camera camera) { bool renderSelected = RenderState.DisplayBound == DisplayFlagModes.Selection || RenderState.DisplayCaption == DisplayFlagModes.Selection || RenderState.DisplayPivot == DisplayFlagModes.Selection; if (renderSelected) { var selection = DesignView.Context.As<ISelectionContext>().Selection; IEnumerable<DomNode> rootDomNodes = DomNode.GetRoots(selection.AsIEnumerable<DomNode>()); RenderProperties(rootDomNodes, RenderState.DisplayCaption == DisplayFlagModes.Selection, RenderState.DisplayBound == DisplayFlagModes.Selection, RenderState.DisplayPivot == DisplayFlagModes.Selection); } if (RenderState.GridMode == RenderState.GridModes.Enabled) { var game = designView.Context.As<IGame>(); GridRenderer gridRender = game.Grid.Cast<GridRenderer>(); gridRender.Render(camera); } RenderProperties(Items, RenderState.DisplayCaption == DisplayFlagModes.Always, RenderState.DisplayBound == DisplayFlagModes.Always, RenderState.DisplayPivot == DisplayFlagModes.Always); GameEngine.DrawText2D(m_pendingCaption, Util3D.CaptionFont, 1, 1, Color.White); }
public static void SetData(uint deviceIndex, Sce.PlayStation.Core.Input.GamePadData data) { Common.Assert (deviceIndex == 0); s_game_pad_data0.SetData (data); }
/// <summary> /// Configure the ProjectLister</summary> /// <param name="treeControl">TreeControl used by ProjectLister</param> /// <param name="treeControlAdapter">TreeControlAdapter used by ProjectLister</param> protected override void Configure(out Sce.Atf.Controls.TreeControl treeControl, out TreeControlAdapter treeControlAdapter) { base.Configure(out treeControl, out treeControlAdapter); treeControl.AllowDrop = true; }
public CommandClientAdapter(Sce.Atf.Applications.ICommandClient adaptee) { m_adaptee = adaptee; }
/// <summary> /// Updates command state for given command</summary> /// <param name="commandTag">Command</param> /// <param name="state">Command state to update</param> public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState state) { if (commandTag is Command) { DesignControl activeControl = m_renderView.ViewControl; if (activeControl == null) return; switch ((Command)commandTag) { case Command.RenderSmooth: state.Check = (activeControl.RenderState.RenderMode & RenderMode.Smooth) != 0; break; case Command.RenderWireFrame: state.Check = (activeControl.RenderState.RenderMode & RenderMode.Wireframe) != 0; break; case Command.RenderOutlined: state.Check = (activeControl.RenderState.RenderMode & RenderMode.Smooth) != 0 && (activeControl.RenderState.RenderMode & RenderMode.Wireframe) != 0; break; case Command.RenderTextured: state.Check = (activeControl.RenderState.RenderMode & RenderMode.Textured) != 0; break; case Command.RenderLight: state.Check = ((activeControl.RenderState.RenderMode & RenderMode.Lit) != 0); break; case Command.RenderBackFace: state.Check = ((activeControl.RenderState.RenderMode & RenderMode.CullBackFace) == 0); break; } } }
void labelSetting(Sce.PlayStation.HighLevel.UI.Label label, string content, float xPosition, float yPosition, float xSize, float ySize, int fontSize, FontStyle fontStyle, UIColor colorOfFont) { label.Text = content; label.SetPosition(xPosition,yPosition); label.SetSize(xSize,ySize); label.TextTrimming = TextTrimming.EllipsisCharacter; label.Font = new UIFont(FontAlias.System, fontSize, fontStyle); label.LineBreak = LineBreak.Word; label.TextColor = colorOfFont; }
/// <summary> /// Updates command state for given command</summary> /// <param name="commandTag">Command</param> /// <param name="state">Command state to update</param> public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState state) { if (commandTag is Command) { NativeDesignControl control = (NativeDesignControl)m_designView.ActiveView; GlobalRenderFlags flags = control.RenderState.RenderFlag; switch ((Command)commandTag) { case Command.RenderSmooth: state.Check = (flags & GlobalRenderFlags.Solid) != 0; break; case Command.RenderWireFrame: state.Check = (flags & GlobalRenderFlags.WireFrame) != 0; break; case Command.RenderOutlined: state.Check = (flags & GlobalRenderFlags.Solid) != 0 && (flags & GlobalRenderFlags.WireFrame) != 0; break; case Command.RenderTextured: state.Check = (flags & GlobalRenderFlags.Textured) != 0; break; case Command.RenderLight: state.Check = ((flags & GlobalRenderFlags.Lit) != 0); break; case Command.RenderBackFace: state.Check = (flags & GlobalRenderFlags.RenderBackFace) != 0; break; case Command.RenderShadow: state.Check = (flags & GlobalRenderFlags.Shadows) == GlobalRenderFlags.Shadows; break; case Command.RenderNormals: state.Check = (flags & GlobalRenderFlags.RenderNormals) == GlobalRenderFlags.RenderNormals; break; // case Command.RealTime: // state.Check = m_designView.RealTime; } } }
public void addToChild(Sce.PlayStation.HighLevel.GameEngine2D.Node node) { node.AddChild(spriteList); }
/// <summary> /// Converts an ATF key code that invokes a command to the WPF keyboard combination used to invoke that command</summary> /// <param name="atfKey">ATF key code</param> /// <returns>WPF keyboard combination to invoke the command</returns> public static KeyGesture ConvertKey(Sce.Atf.Input.Keys atfKey) { return ConvertKey(KeysInterop.ToWf(atfKey)); }
/// <summary> /// Updates command state for given command</summary> /// <param name="commandTag">Command</param> /// <param name="commandState">Command state to update</param> public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState commandState) { }
public void removeFromChild(Sce.PlayStation.HighLevel.GameEngine2D.Node node) { node.Cleanup(); }