private void ribbonButton49_Click(object sender, EventArgs e) { if (ellipsePrimitive == null) { GeoPoint pos = new GeoPoint(); pos.x = 116.3; pos.y = 39.9; pos.srs = m_earthMap.getSRS(); Linear radiusMajor = new Linear(); radiusMajor.set( 250, UnitsType.UNIT_MILES ); Linear radiusMinor = new Linear(); radiusMinor.set( 100, UnitsType.UNIT_MILES ); Angular rotationAngle = new Angular(); rotationAngle.set( 0, UnitsType.UNIT_DEGREES ); Angular arcStart = new Angular(); arcStart.set( 45.0, UnitsType.UNIT_DEGREES ); Angular arcEnd = new Angular(); arcEnd.set( 360.0 - 45.0, UnitsType.UNIT_DEGREES ); ellipsePrimitive = new EllipsePrimitive(); ellipsePrimitive.setPosition( pos ); ellipsePrimitive.setRadiusMajor( radiusMajor ); ellipsePrimitive.setRadiusMinor(radiusMinor); ellipsePrimitive.setRotationAngle(rotationAngle); ellipsePrimitive.setArcStart(arcStart); ellipsePrimitive.setArcEnd(arcEnd); ellipsePrimitive.setPie(true); m_earthRoot.addChild( ellipsePrimitive); } }
private void ribbonButton55_Click(object sender, EventArgs e) { if (circle == null) { GeoPoint pos = new GeoPoint(); pos.x = 116.3; pos.y = 39.9; pos.srs = m_earthMap.getSRS(); Linear linear = new Linear(); linear.set( 300, UnitsType.UNIT_KILOMETERS ); Angular angularStart = new Angular(); angularStart.set(-45.0, UnitsType.UNIT_DEGREES); Angular angularEnd = new Angular(); angularEnd.set( 45.0, UnitsType.UNIT_DEGREES ); circle = new Circle(); circle.setPosition( pos ); circle.setRadius( linear ); circle.setArcStart( angularStart ); circle.setArcEnd( angularEnd ); circle.setPie( true ); m_earthRoot.addChild( circle ); } }
public void Provider() { Module M = new Module("testprovider"); M.Provider <UnicornLauncherProvider>(); M.Config <UnicornConfig>(); var el = Window.Document.CreateElement("p"); Injector injector = Angular.Bootstrap(el, M.Name); describe("Provider", () => { var launcher = injector.Get <UnicornLauncher>("UnicornLauncher"); var timeout = injector.Get("$timeout"); it("should create service in the injector", () => { expect(launcher).not.toBeNull(); }); it("should set parameters in service", () => { expect(launcher.shieldtype).toBe("tinfoil"); }); it("should create service with correct dependency injection", () => { expect(launcher.Timeout).toBe(timeout); }); }); }
public void Interpolate() { describe("$interpolate", () => { Injector injector = Angular.Injector("ng"); var interpolate = injector.Get <Interpolate>("$interpolate"); it("should interpolate strings with given context", () => { var exp = interpolate.Call("Hello {{name | uppercase}}!"); var context = new { name = "Angular" }; expect(exp(context)).toEqual("Hello ANGULAR!"); }); it("should interpolate strings in 'forgiving' mode", () => { var context = new { greeting = "Hello" /*, name: undefined*/ }; var exp = interpolate.Call("{{greeting}} {{name}}!"); expect(exp(context)).toEqual("Hello !"); }); it("should interpolate strings in 'allOrNothing' mode", () => { var context = new { greeting = "Hello", /*, name: undefined*/ }; var context_full = new { greeting = "Hello", name = "Angular" }; var exp = interpolate.Call("{{greeting}} {{name}}!", false, null, true); expect(exp(context)).toBeUndefined(); expect(exp(context_full)).toEqual("Hello Angular!"); }); }); }
private void ribbonButton55_Click(object sender, EventArgs e) { if (circle == null) { GeoPoint pos = new GeoPoint(); pos.x = 116.3; pos.y = 39.9; pos.srs = m_earthMap.getSRS(); Linear linear = new Linear(); linear.set(300, UnitsType.UNIT_KILOMETERS); Angular angularStart = new Angular(); angularStart.set(-45.0, UnitsType.UNIT_DEGREES); Angular angularEnd = new Angular(); angularEnd.set(45.0, UnitsType.UNIT_DEGREES); circle = new Circle(); circle.setPosition(pos); circle.setRadius(linear); circle.setArcStart(angularStart); circle.setArcEnd(angularEnd); circle.setPie(true); m_earthRoot.addChild(circle); } }
public AnimationController(Scope _scope) { names = new List <string>(); names.Add("pippo"); names.Add("pluto"); names.Add(Angular.UpperCase(Angular.BuiltinFilters.jsonFilter.Filter(Angular.Version))); }
public void Sanitize() { describe("$sanitize", () => { Module M = new Module("testsanitize", ngSanitize.ModuleName); var el = Window.Document.CreateElement("p"); Injector injector = Angular.Bootstrap(el, M.Name); Sanitize sanitize = injector.Get <Sanitize>("$sanitize"); it("should sanitize an html string", () => { expect(sanitize("<p>this is<b onmouseover=alert('oo')>dangerous</b>data</p>")).toEqual("<p>this is<b>dangerous</b>data</p>"); }); }); describe("linky Filter", () => { Module M = new Module("testlinkyfilter", ngSanitize.ModuleName); var el = Window.Document.CreateElement("p"); Injector injector = Angular.Bootstrap(el, M.Name); Filter Filter = injector.Get <Filter>("$filter"); var linky = Filter("linky"); it("should convert text into http link", () => { expect(linky("http://www.hello.com")).toBe("<a href=\x22http://www.hello.com\x22>http://www.hello.com</a>"); }); }); }
public static void InitServices() { var services = Angular.Module("phonecatServices", new string[] { "ngResource" }); services.Factory <Func <Func <string, object, ResourceActions, Resource>, Resource> >("phoneService", PhoneServicesFactoryFn); }
public ActionResult Delete(int Id) { Context _context = new Context(); Angular angular = _context.Angulars.FirstOrDefault(x => x.Id == Id); _context.Entry(angular).State = System.Data.Entity.EntityState.Deleted; _context.SaveChanges(); return(Json(new { success = true, JsonRequestBehavior.AllowGet })); }
/** * Three names that identify in order a linear display unit, an area display * unit, and an angular display unit. * * @param l * @param s * @param a */ virtual public void SetDisplayUnits(Linear l, Square s, Angular a) { PdfArray arr = new PdfArray(); arr.Add(DecodeUnits.Decode(l)); arr.Add(DecodeUnits.Decode(s)); arr.Add(DecodeUnits.Decode(a)); base.Put(PdfName.PDU, arr); }
public ActionResult Editsave(string Name, string Phone, int Id) { Context _context = new Context(); Angular angular = _context.Angulars.FirstOrDefault(x => x.Id == Id); angular.Name = Name; angular.Phone = Phone; _context.Entry(angular).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); return(Json(new { success = true, JsonRequestBehavior.AllowGet })); }
public void Locale() { describe("$locale", () => { Injector injector = Angular.Injector("ng"); var loc = injector.Get <Locale>("$locale"); it("should be set to english language/US by default", () => { expect(loc.id).toEqual("en-us"); }); }); }
public static PdfName Decode(Angular e) { switch (e) { case Angular.DEGREE: return(new PdfName("DEG")); case Angular.GRAD: return(new PdfName("GRD")); default: return(null); } }
public void CacheFactory() { describe("$cacheFactory", () => { Injector injector = Angular.Injector("ng"); var cacheFactory = injector.Get <CacheFactory>("$cacheFactory"); var cache = cacheFactory.Create("cacheId"); it("should create a Cache object in the cache", () => { expect(cacheFactory.get("cacheId")).toBe(cache); }); it("should not find unexisting Cache objects", () => { expect(cacheFactory.get("noSuchCacheId")).not.toBeDefined(); }); it("should write values to cache", () => { cache.put("key", "value"); cache.put("another key", "another value"); expect(cache.info()).toEqual(new { id = "cacheId", size = 2 }); expect(cache.get("key")).toEqual("value"); expect(cache.get("another key")).toEqual("another value"); }); it("should remove values from cache", () => { cache.remove("another key"); expect(cache.info()).toEqual(new { id = "cacheId", size = 1 }); }); it("should remove all values from cache", () => { cache.removeAll(); expect(cache.info()).toEqual(new { id = "cacheId", size = 0 }); }); it("should destroy the cache", () => { cache.destroy(); expect(cacheFactory.get("cacheId")).not.toBeDefined(); }); }); }
public static void InitFilters() { var filters = Angular.Module("phonecatFilters"); // The following is equivalent to defining methods // - string mb(string text) { return "sometext"; } // and // - Func<string, string> ma() { return mb; } // Then calling .Filter("text", ma); filters.Filter("checkmark", () => { return((input) => { return (input == "true") ? "\u2713" : "\u2718"; }); }); }
public static IModule GetModule(string filename) { IModule result = null; // load module information from db switch (filename) { case "Module.SinglePage.dll": result = new Angular(); break; case "Module.WebServices.dll": result = new WebSVC(); break; } return(result); }
public static void Init() { var dependencies = new string[] { "ngRoute", "phonecatControllers", "phonecatFilters", "phonecatServices", "phonecatAnimations" }; Angular.Module("phonecatApp", dependencies) .Config <RouteProvider>(App.RouteProviderFn); App.InitControllers(); App.InitFilters(); App.InitServices(); App.InitAnimations(); }
public static void Init() { var appDepend = new string[] { "ngRoute", "phonecatControllers", "phonecatFilters", "phonecatServices", "phonecatAnimations" }; var app = Angular.Module("phonecatApp", appDepend); app.Config <RouteProvider>(RouteProviderFn); var catCtl = Angular.Module("phonecatControllers"); catCtl.Controller <PhoneListScopeModel, PhoneQueryModel> ("PhoneListCtrl", PhoneListCtrlFn); catCtl.Controller <PhoneDetailsScopeModel, PhoneModel, PhoneQueryModel>("PhoneDetailCtrl", PhoneDetailCtrlFn); var catFlt = Angular.Module("phonecatFilters"); // The following is equivalent to defining methods // - string mb(string text) { return "sometext"; } // and // - Func<string, string> ma() { return mb; } // Then calling .Filter("text", ma); catFlt.Filter("checkmark", () => { return((input) => { return (input == "true") ? "\u2713" : "\u2718"; }); }); InitServices(); InitAnimations(); }
public ActionResult Index(string Name, string Phone) { int rate = 0; Context _context = new Context(); Angular angular = new Angular() { Name = Name, Phone = Phone }; _context.Angulars.Add(angular); rate = _context.SaveChanges(); if (rate == 1) { return(Json(new { success = true, JsonRequestBehavior.AllowGet })); } else { return(Json(new { success = false, JsonRequestBehavior.AllowGet })); } }
public void Parse() { describe("$parse", () => { Injector injector = Angular.Injector("ng"); Parse _parse = injector.Get <Parse>("$parse"); var getter = _parse("user.name"); var setter = getter.assign; var context = new { user = new { name = "angular" } }; var locals = new { user = new { name = "local" } }; it("should read and write context in a parsed expression", () => { expect(getter.Call(context)).toEqual("angular"); setter(context, "newValue"); expect(context.user.name).toEqual("newValue"); expect(getter.Call(context, locals)).toEqual("local"); }); }); }
public void DependencyInjection() { describe("Dependecy injection", () => { it("should work with implicit annotation in constructor parameter names", () => { Module M = new Module("test1"); M.Service <TestDIService1>(); // TestDIService1 is a service with an implicit injection named "injected_object" M.Constant("injected_object", 42); Injector injector = Angular.Injector("test1"); var serv = injector.Get <TestDIService1>("TestDIService1"); expect(serv.injected_value).toBe(42); }); it("should work with explicit annotation", () => { Module M = new Module("test2"); M.Constant("injected_object", 16); M.Constant("explicit_injected_object", 42); M.Service <TestDIService1>("explicit_injected_object"); // TestDIService1 is a service with an implicit injection named "injected_object" Injector injector = Angular.Injector("test2"); var serv = injector.Get <TestDIService1>("TestDIService1"); expect(serv.injected_value).toBe(42); }); it("should work with explicit annotation with [Inject] decorator", () => { Module M = new Module("test3"); M.Service <TestDIService2>(); // TestDIService2 is a service with an explicit attribute injection named "attribute_injected_object" M.Constant("attribute_injected_object", 42); Injector injector = Angular.Injector("test3"); var serv = injector.Get <TestDIService1>("TestDIService2"); expect(serv.injected_value).toBe(42); }); }); }
private async Task BaseWorkspaceIntranetTest(string category) { using (var sqlServer = new SqlServer()) { sqlServer.Restart(); sqlServer.Populate(Paths.ArtifactsBaseCommands); using (var server = new Server(Paths.ArtifactsBaseServer)) { using (var angular = new Angular(Paths.BaseWorkspaceTypescript, "intranet:serve")) { await server.Ready(); await angular.Init(); DotNetTest( s => s .SetProjectFile(Paths.BaseWorkspaceIntranetTests) .SetLogger($"trx;LogFileName=BaseIntranet{category}Tests.trx") .SetFilter($"Category={category}") .SetResultsDirectory(Paths.ArtifactsTests)); } } } }
public void Service() { Module M = new Module("testservice"); M.Service <SimpleService>(); var el = Window.Document.CreateElement("p"); Injector injector = Angular.Bootstrap(el, M.Name); describe("Service", () => { var simpleService = injector.Get <SimpleService>("SimpleService"); it("should be defined in the injector", () => { expect(simpleService).not.toBeNull(); }); it("should return the expected value", () => { expect(simpleService.testval).toBe(42); }); }); }
public void Constant() { Module M = new Module("test"); M.Constant("testconst", 42); Injector injector = Angular.Injector("test"); describe("Constant", () => { object testconst = null; it("should be defined in the injector", () => { Action read = () => { testconst = injector.Get("testconst"); }; expect(read).not.toThrow(); }); it("should return the expected value", () => { expect(testconst).toBe(42); }); }); }
public static void InitControllers() { var controllers = Angular.Module("phonecatControllers"); /* * If passing only the reference to the function to the * PhoneListCtrl, this is how it would be done. * * controllers.Controller < PhoneListScopeModel, PhoneQueryModel > * ("PhoneListCtrl", App.PhoneListCtrlFn); */ controllers.Controller ("PhoneListCtrl", Angular.Fn((Action <PhoneListScopeModel, PhoneQueryModel>) ((scope, phoneService) => { scope.Phones = phoneService.Query(); scope.OrderProp = "age"; } ), "$scope", "phoneService")); controllers.Controller <PhoneDetailsScopeModel, PhoneModel, PhoneQueryModel>("PhoneDetailCtrl", App.PhoneDetailCtrlFn); }
public void Factory() { Module M = new Module("testfactory"); M.Factory <SimpleFactories>(); var el = Window.Document.CreateElement("p"); Injector injector = Angular.Bootstrap(el, M.Name); describe("Factory", () => { var factory = injector.Get <string>("SimpleFactory1"); it("should be defined in the injector", () => { expect(factory).not.toBeNull(); }); it("should return the expected value", () => { expect(factory).toBe("fortytwo"); }); }); }
/// <summary> /// AngularJS requires to be defined on document parse. /// TODO: create an onParse attribute /// </summary> public static void StartUp() { Console.Log("Checkpoint Charlie: I must be printed BEFORE " + "Checkpoint 1."); AngularJSDemo.hwbApp = Angular.Module("hwbApp"); var controllerData = new { message = "Hello, AngularJS message " + "defined in Bridge's C#! :D" }; AngularJSDemo.hwbApp.Controller("hwbctl", controllerData); AngularJSDemo.hwbApp.Directive("brdEntryPoint", AngularJSDemo.dynMehTemplate); var checkpoints = new List <object> { new { callsign = "Alpha", id = 98 }, new { callsign = "Baker", id = 78 }, new { callsign = "Charlie", id = 58 }, new { callsign = "Delta", id = 9 } }; var controllerStrongData = new ControllerDataObjectStructure() { Message = "Hello, AngularJS message defined in Bridge's C#'s " + "strongly typed class! :D", Foo = "Foo fighters from strong C#.", Bar = "Strong C# 777 slot", Checkpoints = checkpoints.ToArray() }; AngularJSDemo.hwbApp.Controller("hwbSctl", controllerStrongData); AngularJSDemo.hwbApp.Directive("brdEntryPointForThree", AngularJSDemo.ThreeWayFunction); Document.DocumentElement.SetNGApp(AngularJSDemo.hwbApp); }
private void ribbonButton49_Click(object sender, EventArgs e) { if (ellipsePrimitive == null) { GeoPoint pos = new GeoPoint(); pos.x = 116.3; pos.y = 39.9; pos.srs = m_earthMap.getSRS(); Linear radiusMajor = new Linear(); radiusMajor.set(250, UnitsType.UNIT_MILES); Linear radiusMinor = new Linear(); radiusMinor.set(100, UnitsType.UNIT_MILES); Angular rotationAngle = new Angular(); rotationAngle.set(0, UnitsType.UNIT_DEGREES); Angular arcStart = new Angular(); arcStart.set(45.0, UnitsType.UNIT_DEGREES); Angular arcEnd = new Angular(); arcEnd.set(360.0 - 45.0, UnitsType.UNIT_DEGREES); ellipsePrimitive = new EllipsePrimitive(); ellipsePrimitive.setPosition(pos); ellipsePrimitive.setRadiusMajor(radiusMajor); ellipsePrimitive.setRadiusMinor(radiusMinor); ellipsePrimitive.setRotationAngle(rotationAngle); ellipsePrimitive.setArcStart(arcStart); ellipsePrimitive.setArcEnd(arcEnd); ellipsePrimitive.setPie(true); m_earthRoot.addChild(ellipsePrimitive); } }
public static PdfName Decode(Angular e) { switch (e) { case Angular.DEGREE: return new PdfName("DEG"); case Angular.GRAD: return new PdfName("GRD"); default: return null; } }
public static void InitAnimations() { var anim = Angular.Module("phonecatAnimations", new string[] { "ngAnimate" }); anim.Animation(".phone", () => { Func <jQuery, string, Action, Action <bool> > animateUp = (jQuery element, string className, Action done) => { if (className != "active") { return(null); } element.Css( new { Position = Position.Absolute, Top = 500, Left = 0, Display = Display.Block }); element.Animate(new { Top = 0 }, 400, "swing", done); return((cancel) => { if (cancel) { element.Stop(); } ; }); }; Func <jQuery, string, Action, Action <bool> > animateDown = (jQuery element, string className, Action done) => { if (className != "active") { return(null); } element.Css( new { Position = Position.Absolute, Top = 0, Left = 0 }); element.Animate(new { Top = -500 }, 400, "swing", done); return((cancel) => { if (cancel) { element.Stop(); } ; }); }; return(new Bridge.AngularJS.jQuery.Animation { AddClass = animateUp, RemoveClass = animateDown }); }); }