public void AddPopupApplet <TContext>(TContext context) where TContext : MainContext, new() { // Получение названия попапа из up контрола, на котором произошло действие ControlUP UP = CurrentControl?.ControlUPs?.FirstOrDefault(n => n.Name == "Applet"); string popupName = UP == null ? string.Empty : UP.Value; Applet popup = context.Applets .AsNoTracking() .Include(b => b.BusComp) .Include(cntr => cntr.Controls) .ThenInclude(cntrUp => cntrUp.ControlUPs) .Include(cntr => cntr.Controls) .ThenInclude(f => f.Field) .FirstOrDefault(n => n.Name == popupName); // Добавление попапа и его маршрута в информацию о представлении if (!ViewApplets.Select(n => n.Name).ToList().Contains(popup.Name)) { // Установка этого попапа как текущего CurrentPopupApplet = popup; ViewApplets.Add(popup); ViewItem viewItem = new ViewItem() { Name = popup.Name, Applet = popup, AppletId = popup.Id, Autofocus = true, AutofocusRecord = 0, View = View, ViewId = View.Id }; ViewItems.Add(viewItem); View.ViewItems.Add(viewItem); } }
/// <summary> /// Подключить апплеты. /// Если все успешно, вернет true. /// </summary> /// <param name="SrcApplet">Апплет, к которому подключаемся</param> /// <param name="DstApplet">Апплет, который подключаем</param> /// <param name="SrcPinName">Имя выходного пина, к которому подключаемся</param> /// <param name="DstPinName">Имя входного пина, который подключаем</param> /// <returns></returns> public bool ConnectApplets(Applet SrcApplet, Applet DstApplet, string SrcPinName, string DstPinName) { Pin src_outpin = SrcApplet.OutputPins.First(pin => pin.Name == SrcPinName); Pin dst_inpin = DstApplet.InputPins.First(pin => pin.Name == DstPinName); if (src_outpin == null) { System.Diagnostics.Debug.Print("Pin {0} is mising", SrcPinName); return false; } if (dst_inpin == null) { System.Diagnostics.Debug.Print("Pin {0} is mising", DstPinName); return false; } try { //соединяем src_outpin.Connect(dst_inpin); dst_inpin.Connect(src_outpin); } catch (ConnectException cex) { System.Diagnostics.Debug.Print(cex.Message); return false; } return true; }
public override IEnumerable <ValidationResult> DataBUSValidate(SysEmployee_1 dataEntity, SysEmployee_2 businessEntity, IViewInfo viewInfo, GSAppContext context) { List <ValidationResult> result = base.DataBUSValidate(dataEntity, businessEntity, viewInfo, context).ToList(); Applet currentApplet = viewInfo.CurrentPopupApplet ?? viewInfo.CurrentApplet; return(result); }
public static IHTMLElement AutoSizeAppletTo(this Applet e, IHTMLElement shadow) { var i = e.ToHTMLElement(); Action Update = delegate { var w = shadow.scrollWidth; var h = shadow.scrollHeight; i.style.SetSize(w, h); }; Native.window.onresize += delegate { Update(); }; Update(); return(i); }
public virtual ActionResult <string> PartialUpdateContext([FromBody] RequestAppletModel model) { // Получение всех необходимых сущностей Applet applet = viewInfo.ViewApplets.FirstOrDefault(n => n.Name == model.AppletName); BusinessObjectComponent component = viewInfo.BOComponents.FirstOrDefault(bcId => bcId.BusCompId == applet.BusCompId); // Получение списка с апплетами, необходимыми для обновления. Если есть флаг обновления текущего апплета, то он добавляется в выходной список List <Applet> appletsToUpdate = new List <Applet>(); if (model.RefreshCurrentApplet) { appletsToUpdate.Add(applet); } // Добавление всех апплетов, основанных на той же компоненте и не являющихся попапами в список для обновления viewInfo.ViewApplets.ForEach(viewApplet => { if (viewApplet.BusCompId == applet.BusCompId && viewApplet.Id != applet.Id && viewApplet.Type != "Popup") { appletsToUpdate.Add(viewApplet); } }); AppletListBuilding(new List <BusinessObjectComponent>(), component, component, appletsToUpdate); appletsToUpdate = appletsToUpdate.Where(i => i.Initflag == false).ToList(); //viewInfo.AppletsSortedByLinks.AddRange(appletsToUpdate); // Result return(JsonConvert.SerializeObject(appletsToUpdate.Select(n => n.Name), Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); }
internal BeansAppletStub(Applet target, AppletContext context, URL codeBase, URL docBase) { this.Target = target; this.Context = context; this.CodeBase_Renamed = codeBase; this.DocBase = docBase; }
public static void ReplaceWith(this IHTMLElement e, Applet value) { var c = value.ToHTMLElement(); // should we do it here? :) c.style.display = IStyle.DisplayEnum.inline_block; e.ReplaceWith(c); }
public override BUSDrilldown Init(TContext context) { BUSDrilldown businessEntity = base.Init(context); Applet applet = context.Applets .AsNoTracking() .Select(a => new { id = a.Id, busCompId = a.BusCompId, busComp = a.BusComp == null ? null : new { id = a.BusComp.Id, name = a.BusComp.Name } }) .Select(a => new Applet { Id = a.id, BusCompId = a.busCompId, BusComp = a.busComp == null ? null : new BusinessComponent { Id = a.busComp.id, Name = a.busComp.name } }) .FirstOrDefault(i => i.Id.ToString() == ComponentsRecordsInfo.GetSelectedRecord("Applet")); if (applet?.BusComp != null) { businessEntity.SourceBusinessComponent = applet.BusComp; businessEntity.SourceBusinessComponentId = (Guid)applet.BusCompId; } return(businessEntity); }
public static void EnableVisualStyles(this Applet a) { // a dirty redirect. Application.EnableVisualStyles(); SwingUtilities.updateComponentTreeUI(a); }
public override BUSViewItem UIToBusiness(UIViewItem UIEntity, TContext context, IViewInfo viewInfo, bool isNewRecord) { BUSViewItem businessEntity = base.UIToBusiness(UIEntity, context, viewInfo, isNewRecord); View view = context.Views .AsNoTracking() .Select(v => new { id = v.Id, name = v.Name, viewItems = v.ViewItems.Select(viewItem => new { id = viewItem.Id, name = viewItem.Name, }) }) .Select(v => new View { Id = v.id, Name = v.name, ViewItems = v.viewItems.Select(viewItem => new ViewItem { Id = viewItem.id, Name = viewItem.name }).ToList() }) .FirstOrDefault(n => n.Id.ToString() == ComponentsRecordsInfo.GetSelectedRecord("View")); if (view == null) { businessEntity.ErrorMessage = "First you need create view."; } else { // Если запись новая и она не уникальна, записывается ошибка ViewItem viewItem = view.ViewItems?.FirstOrDefault(n => n.Name == UIEntity.Name); if (viewInfo.ViewItems != null && viewItem != null && viewItem.Id != UIEntity.Id) { businessEntity.ErrorMessage = $"View item with this name is already exists in view {view.Name}."; } else { businessEntity.View = view; businessEntity.ViewId = view.Id; Applet applet = context.Applets.AsNoTracking().FirstOrDefault(n => n.Name == UIEntity.AppletName); if (applet != null) { businessEntity.Applet = applet; businessEntity.AppletId = applet.Id; businessEntity.AppletName = applet.Name; } businessEntity.Autofocus = UIEntity.Autofocus.ToString() == string.Empty || UIEntity.Autofocus; businessEntity.AutofocusRecord = UIEntity.AutofocusRecord.ToString() == string.Empty ? 0 : UIEntity.AutofocusRecord; } } return(businessEntity); }
public static void ReplaceWith(this IHTMLElement e, Applet value) { var c = value.ToHTMLElement(); // should we do it here? :) c.style.display = IStyle.DisplayEnum.inline_block; e.ReplaceWith(c); }
public QvgaScreen(Applet applet, Device device) : base(applet, device) { Background = CsLglcd.UI.Properties.Resources.qvga_background; Header = CsLglcd.UI.Properties.Resources.qvga_header; BaseFont = Fonts.Qvga.Normal; IconBackground = CsLglcd.UI.Properties.Resources.qvga_background_headericon; }
public static IHTMLElement AttachAppletTo(this Applet e, INode parent) { var i = e.ToHTMLElement(); parent.appendChild(i); return(i); }
public QvgaScreen(Applet applet, Device device) : base(applet, device) { Background = CsLglcd.UI.Properties.Resources.qvga_background; Header = CsLglcd.UI.Properties.Resources.qvga_header; BaseFont = Fonts.Qvga.Normal; IconBackground = CsLglcd.UI.Properties.Resources.qvga_background_headericon; }
public static void ReplaceContentWith(this Applet a, UserControl u) { var s = u.Size; a.setSize(s.Width, s.Height); u.AttachTo(a); }
public static IHTMLElement ToHTMLElement(this Applet e) { // at the moment the .castclass opcode will be translated only within // rewriteable assemblies var i = (IHTMLElement)(object)e; return(i); }
public AudioPlaybackEngine(Applet applet, int sampleRate = 44100, int channelCount = 2) { applet.GetSketch().Exited += (o, e) => Dispose(); outputDevice = new WaveOutEvent(); mixer = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channelCount)); mixer.ReadFully = true; outputDevice.Init(mixer); outputDevice.Play(); }
public virtual void CancelQuery() { viewInfo.ActionType = ActionType.CancelQuery; Applet applet = viewInfo.CurrentPopupApplet ?? viewInfo.CurrentApplet; BusinessObjectComponent objectComponent = viewInfo.BOComponents.FirstOrDefault(i => i.BusCompId == applet.BusCompId); SetSearchSpecification(objectComponent.Name, SearchSpecTypes.SearchSpecification, string.Empty); SetSearchSpecification(objectComponent.Name, SearchSpecTypes.SearchSpecArgs, null); }
// Start is called before the first frame update void Start() { Arx.Shutdown(); applet = new Applet(appletFiles) { uploadOnConnection = true, }; applet.Connected.AddListener(() => Show()); applet.Tap.AddListener(z => BuyItem(z)); }
public void FailToLocateProcessTest() { bool DefSuccessEval(int i, bool b) => b; bool DefOutputEval(string s) => s.Equals("0"); var applet = Applet <object, bool> .Create("", DefSuccessEval, DefOutputEval); Assert.IsFalse(applet.Run(new object())); }
public void TestProcessRunWithNoOutputEvaluator() { const string name = "TestProcess"; var applet1 = Applet <object, bool> .Create(name, (i, b) => i == 0, s => true, testExecutablePath, ""); var applet2 = Applet <object, bool> .Create(name, (i, b) => i == 0, s => true, testExecutablePath, "3"); Assert.IsTrue(applet1.Run(new object() )); Assert.IsFalse(applet2.Run(new object())); }
public void TestName() { const string name1 = "app"; const string name2 = ""; var applet1 = Applet <object, bool> .Create(name1, (i, b) => true, s => true); var applet2 = Applet <object, bool> .Create(name2, (i, b) => true, s => true); Assert.IsTrue(name1.Equals(applet1.Name)); Assert.IsTrue(name2.Equals(applet2.Name)); }
public void RemovePopupApplet <TContext>(TContext context) where TContext : MainContext, new() { // Удаление попапа из списка аппетов представления и из информации о представлении ViewItem viewItem = View.ViewItems.FirstOrDefault(ap => ap.AppletId == CurrentPopupApplet.Id); Applet applet = ViewApplets.FirstOrDefault(i => i.Id == viewItem.AppletId); ViewItems.Remove(viewItem); View.ViewItems.Remove(viewItem); ViewApplets.Remove(applet); CurrentPopupApplet = null; CurrentPopupControl = null; }
public override IEnumerable <ValidationResult> UIValidate(TContext context, IViewInfo viewInfo, UIApplet UIEntity, bool isNewRecord) { List <ValidationResult> result = base.UIValidate(context, viewInfo, UIEntity, isNewRecord).ToList(); Applet applet = context.Applets.AsNoTracking().FirstOrDefault(n => n.Name == UIEntity.Name); if (applet != null && applet.Id != UIEntity.Id) { result.Add(new ValidationResult("Applet with this name is already exists.", new List <string>() { "Name" })); } return(result); }
public void TestProcessRunWithInputEvaluator() { const string name = "TestProcess"; bool DefSuccessEval(int i, bool b) => b; bool DefOutputEval(string s) => s.Equals("0"); var applet1 = Applet <object, bool> .Create(name, DefSuccessEval, DefOutputEval, testExecutablePath, ""); var applet2 = Applet <object, bool> .Create(name, DefSuccessEval, DefOutputEval, testExecutablePath, "3"); Assert.IsTrue(applet1.Run(new object())); Assert.IsFalse(applet2.Run(new object())); }
public virtual ActionResult <object> UpdateViewInfo([FromBody] RequestViewModel model) { Applet applet = viewInfo.ViewApplets.FirstOrDefault(n => n.Name == model.TargetApplet); viewInfo.ActionType = (ActionType)Enum.Parse(typeof(ActionType), model.ActionType); if (applet != null) { BusinessComponent component = viewInfo.ViewBCs.FirstOrDefault(i => i.Id == applet.BusCompId); // Текущий апплет viewInfo.CurrentApplet = applet; // Текущий контрол viewInfo.CurrentControl = applet.Controls.FirstOrDefault(n => n.Name == model.CurrentControl); viewInfo.CurrentColumn = applet.Columns.FirstOrDefault(n => n.Name == model.CurrentColumn); // При выборе из списка устанавливается выбранная запись if (model.CurrentRecord != null) { viewInfo.CurrentRecord = model.CurrentRecord; ComponentsRecordsInfo.SetSelectedRecord(component.Name, model.CurrentRecord); } } // В процессе работы с попапом if (viewInfo.CurrentPopupApplet != null) { // Текущий контрол на попапе viewInfo.CurrentPopupControl = viewInfo.CurrentPopupApplet?.Controls.FirstOrDefault(n => n.Name == model.CurrentPopupControl); } // Открытие/закрытие попапа if (model.OpenPopup) { viewInfo.AddPopupApplet(context); } if (model.ClosePopup && viewInfo.CurrentPopupApplet != null) { viewInfo.RemovePopupApplet(context); } // В случае отмены создания записи, проставление null в контексте бизнес компоненты апплета if (viewInfo.ActionType == ActionType.UndoRecord) { TBUSFactory busFactory = new TBUSFactory(); busFactory.SetRecord(null, context, viewInfo, viewInfo.CurrentPopupApplet?.BusComp ?? viewInfo.CurrentApplet.BusComp, null); } viewInfoUI.Initialize(context); return(viewInfoUI.Serialize()); }
public override BUSViewItem DataToBusiness(ViewItem dataEntity, TContext context) { BUSViewItem businessEntity = base.DataToBusiness(dataEntity, context); Applet applet = context.Applets.AsNoTracking().FirstOrDefault(i => i.Id == dataEntity.AppletId); if (applet != null) { businessEntity.Applet = applet; businessEntity.AppletId = applet.Id; businessEntity.AppletName = applet.Name; } businessEntity.View = context.Views.AsNoTracking().FirstOrDefault(i => i.Id == dataEntity.ViewId); businessEntity.ViewId = dataEntity.ViewId; businessEntity.Autofocus = dataEntity.Autofocus; businessEntity.AutofocusRecord = dataEntity.AutofocusRecord; return(businessEntity); }
public void TestProcessExceptionsTest() { const string name = "TestProcess"; bool DefSuccessEval(int i, bool b) => b; bool DefOutputEval(string s) => s.Equals("0"); var app1 = Applet <object, bool> .Create(name, DefSuccessEval, DefOutputEval, testExecutablePath, "win32"); var app2 = Applet <object, bool> .Create(name, DefSuccessEval, DefOutputEval, testExecutablePath, "sys"); var res1 = app1.Run(new object()); var res2 = app2.Run(new object()); Assert.IsFalse(res1); Assert.IsFalse(res2); }
public AppletMediaJukebox(MediaJukeboxAutomation mj, MainInterface ui) { MJ = mj; UI = ui; LgLcdLib = new Lglcd(); LglcdApplet = new Applet() { SupportedDevices = SupportedDevices.QVGA, Title = "Media Jukebox" }; QvgaDevice = new Device <QvgaImageUpdater>() { Applet = LglcdApplet }; LglcdApplet.DeviceArrival += new EventHandler <DeviceEventArgs>(LglcdApplet_DeviceArrival); LglcdApplet.DeviceRemoval += new EventHandler <DeviceEventArgs>(LglcdApplet_DeviceRemoval); m_RaisePriorityUntil = DateTime.Now.Add(Properties.Settings.Default.RaisedPriorityTimeout); /*try * { * Initialize(); * InitializeLcdForm(); * UpdateValues(); * UpdateGraphics(); * } * catch (Exception e) * { * System.Windows.Forms.MessageBox.Show("A Fatal error has occured while creating plugin:-" + e.Message + * "\n The Failure Occured" + * "\n In Class Object " + e.Source + * "\n when calling Method " + e.TargetSite + * "\n \n The following Inner Exception was caused" + e.InnerException + * "\n \n The Stack Trace Follows: \n\n" + e.StackTrace); * }*/ TrackChange += new EventHandler <MediaJukeboxEventArgs>(AppletMediaJukebox_TrackChange); PlayerStateChange += new EventHandler <MediaJukeboxEventArgs>(AppletMediaJukebox_PlayerStateChange); InitializeLcdForm(); m_InitializationTimer = new Timer(new TimerCallback(TimerHandler), null, TimeSpan.Zero, TimeSpan.FromSeconds(1.0)); }
public override BUSColumn DataToBusiness(Column dataEntity, TContext context) { BUSColumn businessEntity = base.DataToBusiness(dataEntity, context); businessEntity.IconId = dataEntity.IconId; // Applet Applet applet = context.Applets.AsNoTracking().FirstOrDefault(i => i.Id == dataEntity.AppletId); businessEntity.Applet = applet; businessEntity.AppletId = applet.Id; businessEntity.BusComp = applet.BusComp; businessEntity.BusCompId = applet.BusCompId; // Field Field field = context.Fields.AsNoTracking().FirstOrDefault(i => i.Id == dataEntity.FieldId); if (field != null) { businessEntity.Field = field; businessEntity.FieldId = field.Id; businessEntity.FieldName = field.Name; } else { dataEntity.Field = null; dataEntity.FieldId = null; } // Ридонли на филде приоритетнее ридонли на колонке, поэтому вначале проверяется филда. Затем, если на ней нет ридонли, то свойство берется с колонки if (field != null && field.Readonly) { businessEntity.Readonly = true; } else { businessEntity.Readonly = dataEntity.Readonly; } businessEntity.ActionType = dataEntity.ActionType; businessEntity.Header = dataEntity.Header; businessEntity.Type = dataEntity.Type; businessEntity.Required = dataEntity.Required; return(businessEntity); }
/* * //[Script(IsDebugCode = true)] * static void Test() * { * throw new global::csharp.ThrowableException(); * } * * //[Script(IsDebugCode = true)] * static void Test2() * { * try * { * Test(); * } * catch (csharp.ThrowableException e) * { * throw; * } * } */ public static object EvaluateJavaScript(Applet that, string js) { object r = null; try { // 2047 // http://www.rgagnon.com/javadetails/java-0172.html var c = global::java.lang.Class.forName("netscape.javascript.JSObject"); reflect.Method getWindow = null; reflect.Method eval = null; foreach (reflect.Method m in c.getMethods()) { if (m.getName() == "getWindow") { getWindow = m; } if (m.getName() == "eval") { eval = m; } } var getWindow_Arguments = new object[] { that }; var jsWindow = getWindow.invoke(c, getWindow_Arguments); var eval_Arguments = new object[] { js }; r = eval.invoke(jsWindow, eval_Arguments); //base.getAppletContext().showDocument(new URL("javascript:" + js)); } catch (global::csharp.ThrowableException e) { throw new global::csharp.RuntimeException("Script is not supported. " + e.Message); } return(r); }
public ActionResult GetxcxList() { Stopwatch watch = new Stopwatch();//监控抓取耗时 watch.Start(); //https://www.xcxdh666.com/pageList.htm?pageNum=0 dataList var result = new Result(); for (int j = 0; j < 54; j++) { string url = $"https://www.xcxdh666.com/pageList.htm?pageNum={j}"; var str = url.GetPostPage(null);//HttpWebRequest 请求页面 if (str != null) { result = str.JsonConvert <Result>(); //string 的序列化扩展方法 } result.dataList.ForEach(i => { if (!Db.Applet.Any(x => x.Name == i.name))//判断重复插入 { var x = new Applet() { CategoryName = string.IsNullOrEmpty(i.categoryName) ? "其它" : i.categoryName, Name = i.name, SaomiaoUrl = QiniuUplod($"http://img.xcxdh666.com/wxappnav/{i.saomaUrl}"), Summary = i.sum, LogoUrl = QiniuUplod($"http://img.xcxdh666.com/wxappnav/{i.logoUrl}"), SortNum = j, CreateUser = "******", CreateTime = DateTime.Now }; Db.Applet.Add(x); } }); Db.SaveChanges(); } watch.Stop(); return(Content("爬取完成!本次请求总共耗时:" + watch.ElapsedMilliseconds)); }
static void Main(string[] args) { Console.WriteLine("Testing basic functionality for CsLglcd"); Console.WriteLine("Loading applet..."); using (Lglcd lglcd = new Lglcd()) { Applet helloWorldApplet = new Applet(); helloWorldApplet.SupportedDevices = SupportedDevices.QVGA; helloWorldApplet.Title = "Hello World 1"; helloWorldApplet.Connect(); Device <QvgaImageUpdater> qvgaDevice = new Device <QvgaImageUpdater>(); qvgaDevice.Applet = helloWorldApplet; qvgaDevice.DeviceType = Devices.QVGA; qvgaDevice.Attach(); Console.WriteLine("Press ENTER to draw a test image"); Console.ReadLine(); Bitmap testImage = qvgaDevice.SpecializedImageUpdater.CreateValidImage(); using (Graphics g = Graphics.FromImage(testImage)) { g.FillRectangle(Brushes.Red, 0, 0, testImage.Width, testImage.Height); g.DrawString("Hello world", new Font("monospace", 12f), Brushes.White, 15f, 15f); } qvgaDevice.SpecializedImageUpdater.SetPixels(testImage); qvgaDevice.Update(); Console.WriteLine("Press ENTER to cleanup memory"); Console.ReadLine(); testImage.Dispose(); qvgaDevice.Detach(); qvgaDevice.Dispose(); helloWorldApplet.Disconnect(); helloWorldApplet.Dispose(); } Console.WriteLine("Press ENTER to close application"); Console.ReadLine(); }
/// <summary> /// Полностью разъединяет апплеты между собой /// </summary> /// <param name="Applet1"></param> /// <param name="Applet2"></param> public void DisconnectApplets(Applet Applet1, Applet Applet2) { foreach (Pin outpin in Applet1.OutputPins) { foreach (Pin inpin in Applet2.InputPins) { if (outpin.Connected(inpin)) inpin.Disconnect(); } } foreach (Pin outpin in Applet2.OutputPins) { foreach (Pin inpin in Applet1.InputPins) { if (outpin.Connected(inpin)) inpin.Disconnect(); } } }
/// <summary> /// Конструктор пина /// </summary> /// <param name="PinName">Имя пина. Оно должно быть уникальным впределах одного апплета</param> /// <param name="applet">Апплет, которому принадлежит пин</param> public Pin(string PinName, Applet applet) { Name = PinName; }
public Screen(Applet applet, Device device) { Applet = applet; Device = device; }
////////////////// ////// main ////// ////////////////// public static void Main (string[] args) { Applet myApplet = new Applet(); myApplet.run(); }
/// <summary> /// Подключить апплеты. /// Если все успешно, вернет true. /// По умолчанию соединяются MainInPin и MainOutPin /// </summary> /// <param name="src_app">Апплет, к которому подключаемся</param> /// <param name="dst_app">Апплет, который подключаем</param> public bool ConnectApplets(Applet src_app, Applet dst_app) { return ConnectApplets(src_app, dst_app, "MainOutPin", "MainInPin"); }
/// <summary> /// Зарегистрировать апплет /// </summary> /// <param name="applet"></param> public void RegisterApplet(Applet applet) { m_Applets.Add(applet); }