private void UpdateCheckmarks(TreeNodeCollection items) { TreeView treeView = Control as TreeView; if ((treeView != null) && (items != null)) { foreach (TreeNode item in items) { if (IsCheckbox(treeView, item)) { string name = treeView.UniqueID + "n" + _checkboxIndex.ToString() + "CheckBox"; bool bIsNowChecked = (Page.Request.Form[name] != null); if (item.Checked != bIsNowChecked) { item.Checked = bIsNowChecked; Extender.RaiseAdaptedEvent("TreeNodeCheckChanged", new TreeNodeEventArgs(item)); } _checkboxIndex++; } if (HasChildren(item)) { UpdateCheckmarks(item.ChildNodes); } } } }
public ActionResult Create(string url, bool pretty) { if (url == null) { return(BadRequest("You did not supply a URL")); } try { string extended = Extender.Add(SanitizeUrl(url)); if (pretty) { return(Ok($"Your {config.magicWord}-extended URL is:\n{config.rootUrl}{extended}")); } else { return(Ok(config.rootUrl + extended)); } } catch (ArgumentException e) { if (e.Message == "Invalid URL") { return(BadRequest(e.Message)); } else { throw e; } } }
private void BuildItems(TreeNodeCollection items, bool isRoot, bool isExpanded, HtmlTextWriter writer) { if (items.Count > 0) { writer.WriteLine(); writer.WriteBeginTag("ul"); if (isRoot) { writer.WriteAttribute("id", Extender.MakeChildId("UL")); } if (!isExpanded) { writer.WriteAttribute("class", "AspNet-TreeView-Hide"); } writer.Write(HtmlTextWriter.TagRightChar); writer.Indent++; foreach (TreeNode item in items) { BuildItem(item, writer); } writer.Indent--; writer.WriteLine(); writer.WriteEndTag("ul"); } }
public MainViewmodel() { ConfigError = Config.Instance.Error; ReloadCommand = new RelayCommand(Reload); EscapeCommand = new RelayCommand(EscapePressed); ResetPingsCommand = new RelayCommand(ResetPings); Devices = new BindingList <DeviceModel>(); GraphItems = new BindingList <GraphItem>(); BindingOperations.EnableCollectionSynchronization(Devices, _syncLock); BindingOperations.EnableCollectionSynchronization(GraphItems, _syncLock); StartWithWindows = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true).GetValue("MillenniumTools") != null; _workers = new List <WorkerModel>(); var router = new Router(Config.Instance.RouterIP); var routerModel = getDevice(Config.Instance.RouterIP); RestartRouterCommand = new RelayCommand(() => router.RestartModem(), () => routerModel.IsAuthenticated == true); _workers.Add(new WorkerModel { Worker = getRouterWorker(router, Config.Instance.RouterUsername, Config.Instance.RouterPassword), Device = router }); foreach (var ip in Config.Instance.ExtenderIPs) { var extender = new Extender(ip); _workers.Add(new WorkerModel { Worker = getExtenderWorker(extender, Config.Instance.ExtenderUsername, Config.Instance.ExtenderPassword), Device = extender }); } foreach (var ip in Config.Instance.ReferenceIPs) { var reference = new ReferenceDevice(ip); _workers.Add(new WorkerModel { Worker = getReferenceWorker(reference), Device = reference }); } _reloadTimer = new Timer { AutoReset = true, Enabled = false, Interval = Config.Instance.ReloadInterval.TotalMilliseconds }; _reloadTimer.Elapsed += (s, e) => Reload(); Reload(); _reloadTimer.Start(); _pingTimer = new Timer { AutoReset = true, Enabled = false, Interval = Config.Instance.PingInterval.TotalMilliseconds }; _pingTimer.Elapsed += (s, e) => DoPing(); _pingTimer.Start(); }
public void AddExtension(Selector selector, Extend extends, Env env) { foreach (var extending in extends.Exact) { Extender match = null; if ((match = Extensions.OfType <ExactExtender>().FirstOrDefault(e => e.BaseSelector.ToString().Trim() == extending.ToString().Trim())) == null) { match = new ExactExtender(extending); Extensions.Add(match); } match.AddExtension(selector, env); } foreach (var extending in extends.Partial) { Extender match = null; if ((match = Extensions.OfType <PartialExtender>().FirstOrDefault(e => e.BaseSelector.ToString().Trim() == extending.ToString().Trim())) == null) { match = new PartialExtender(extending); Extensions.Add(match); } match.AddExtension(selector, env); } }
public override void Draw(SpriteBatch spriteBatch, Point playerPos, Direction faceDirection, Rectangle inRect) { Surfaces = Extender.Surfaces(); DrawImpl(spriteBatch, playerPos.X, playerPos.Y, faceDirection, inRect); }
public FormMain() { InitializeComponent(); this.Icon = Properties.Resources.billiard; this.Text = AppCode.AssemblyProduct; this.WindowState = FormWindowState.Maximized; toolStripStatusLabel_CompanyName.Text = ""; try { MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { toolStripStatusLabel_CompanyName.Text = "Registered to : " + set.CompanyName + " "; } //f_Bil.Show(dockPanel1); m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString); Extender.SetSchema(dockPanel1, Extender.Schema.VS2005); } catch (Exception) { } }
public Ph(Extender uart) { //start thread Thread Ph = new Thread(new ThreadStart(PhThread)); Ph.Start(); }
private void WriteCreateUserButtonPanel(HtmlTextWriter writer, CreateUserWizard wizard) { Control btnParentCtrl = wizard.FindControl("__CustomNav0"); if (btnParentCtrl != null) { string id = "_CustomNav0_StepNextButton"; string idWithType = WebControlAdapterExtender.MakeIdWithButtonType("StepNextButton", wizard.CreateUserButtonType); Control btn = btnParentCtrl.FindControl(idWithType); if (btn != null) { Page.ClientScript.RegisterForEventValidation(btn.UniqueID); PostBackOptions options = new PostBackOptions(btn, "", "", false, false, false, false, true, wizard.ID); string javascript = "javascript:" + Page.ClientScript.GetPostBackEventReference(options); javascript = Page.Server.HtmlEncode(javascript); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-CreateUserWizard-CreateUserButtonPanel"); Extender.WriteSubmit(writer, wizard.CreateUserButtonType, wizard.CreateUserButtonStyle.CssClass, id, wizard.CreateUserButtonImageUrl, javascript, wizard.CreateUserButtonText); if (wizard.DisplayCancelButton) { Extender.WriteSubmit(writer, wizard.CancelButtonType, wizard.CancelButtonStyle.CssClass, "_CustomNav0_CancelButton", wizard.CancelButtonImageUrl, "", wizard.CancelButtonText); } WebControlAdapterExtender.WriteEndDiv(writer); } } }
public ActionResult HitCount(string url, bool pretty = false) { try { string clean = SanitizeUrl(url); int hits = Extender.GetHits(clean); if (pretty) { return(Ok($"The {config.magicWord}-extended version of {url} has been visited {hits} time(s)")); } else { return(Ok(Extender.GetHits(clean))); } } catch (KeyNotFoundException) { return(NotFound($"The provided URL has not yet been {config.magicWord}-extended")); } catch (ArgumentException e) { if (e.Message == "Invalid URL") { return(BadRequest(e.Message)); } else { throw e; } } }
private void FormMain_Load(object sender, EventArgs e) { lbl_LoginTime.Text = DateTime.Now.ToString("f"); try { Extender.SetSchema(dockPanel1, Extender.Schema.VS2005); } catch (Exception) { } timer1_Tick(null, null); timer1.Start(); try { if (set != null) { toolStripStatusLabel_CompanyName.Text = set.CompanyName; } else { toolStripStatusLabel_CompanyName.Text = "Demo Version "; } } catch (Exception) { toolStripStatusLabel_CompanyName.Text = ""; } if (pengingatToolStripMenuItem.Enabled) { pengingatToolStripMenuItem.PerformClick(); } }
protected override void OnListBoxDetached() { Extender.Dispose(); Extender = null; _extender.Dispose(); _extender = null; base.OnListBoxDetached(); }
protected virtual int TileToDraw(int x, int y) { if (y < 0 || y >= TheMap.Height || x < 0 || x >= TheMap.Width) { return(Extender.GetOutsideTile(centerPoint, x, y)); } return(TheMap[x, y]); }
public ActionResult ExtenderDereferance(string url) { try { return(new RedirectResult(Extender.Dereferance(url))); } catch (System.Collections.Generic.KeyNotFoundException) { return(NotFound("Error 404: This URL does not exist")); } }
/// <summary> /// 主界面构造函数1,根据配置文件的设置,初始化可停靠窗体 /// </summary> /// <param name="user"></param> public frmMainForm(IModel user) { InitializeComponent(); this.Text = GetConfig.HospitalName; this.frmDockList = new List <DockForm>(); myMainForm = this; iUser = user; Extender.SetSchema(this.dockPanel, BaseControls.Docking.Extender.Schema.FromBase); m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString); if (GetConfig.DALAndModel == "SIS") { SIS_Model.MUser muser = (SIS_Model.MUser)iUser; this.tssl_User.Text = muser.DOCTOR_NAME; this.tssl_Dept.Text = muser.CLINIC_OFFICE; BuildStruct(); this.initExamInfText(); iGather = (frmImageGather)this.SetFormDisplay("图像采集", "SIS.frmImageGather"); qQuery = (frmQuickQuery)this.SetFormDisplay("快速查询", "SIS.frmQuickQuery"); } else { PACS_Model.MUser muser = (PACS_Model.MUser)iUser; this.tssl_User.Text = muser.USER_NAME; this.tssl_Dept.Text = muser.DEPT_NAME; this.p_Patient.Visible = false; switch (GetConfig.SystemType) { case "DeptManage": BuildStructPacsDeptManage(); break; case "Register": BuildStructPacs(); qQuery = (frmQuickQuery)this.SetFormDisplay("快速查询", "SIS.frmQuickQuery"); break; case "QualityControl": BuildStructPacsQualityControl(); break; } } this.timer_Main.Start(); string configFile = Application.StartupPath + "\\Config\\MainDockPanel.config"; if (File.Exists(configFile)) { dockPanel.LoadFromXml(configFile, m_deserializeDockContent); } for (int i = 0; i < this.frmDockList.Count; i++) { if (!frmDockList[i].isShow) { frmDockList[i].frmDock.Show(this.dockPanel, BaseControls.Docking.DockState.DockLeft); } } }
public PIR_Module(Extender extender, DomoteerWebServer server) { this.server = server; this.extender = extender; interrupt = extender.CreateInterruptInput(GT.Socket.Pin.Three, GT.SocketInterfaces.GlitchFilterMode.Off, GT.SocketInterfaces.ResistorMode.PullUp, GT.SocketInterfaces.InterruptMode.FallingEdge); interrupt.Interrupt += new GT.SocketInterfaces.InterruptEventHandler(mov_det); timer_cross = new GT.Timer(20000); timer_cross.Tick += new GT.Timer.TickEventHandler(Timer_Cross_Tick); }
protected override void RenderBeginTag(HtmlTextWriter writer) { if (Extender.AdapterEnabled) { Extender.RenderBeginTag(writer, "AspNet-CreateUserWizard"); } else { base.RenderBeginTag(writer); } }
protected override void RenderBeginTag(HtmlTextWriter writer) { if (Extender.AdapterEnabled) { Extender.RenderBeginTag(writer, "AspNet-DataList"); } else { base.RenderBeginTag(writer); } }
protected override void RenderEndTag(HtmlTextWriter writer) { if (Extender.AdapterEnabled) { Extender.RenderEndTag(writer); } else { base.RenderEndTag(writer); } }
protected override void RenderBeginTag(HtmlTextWriter writer) { if (Extender.AdapterEnabled) { Extender.RenderBeginTag(writer, _classMain); } else { base.RenderBeginTag(writer); } }
public RoboticArmController(Extender extender, GT.Socket.Pin clawPin, GT.Socket.Pin armPin, uint pwmPulsePeriod) { if (extender == null) { throw new ApplicationException("robotic arm pwm extender not set up correctly"); } _pwmPulsePeriod = pwmPulsePeriod; _clawPwm = extender.SetupPWMOutput(clawPin); _armPwm = extender.SetupPWMOutput(armPin); Reset(); }
private void FormMain_Load(object sender, EventArgs e) { lbl_LoginTime.Text = DateTime.Now.ToString("f"); try { Extender.SetSchema(dockPanel1, Extender.Schema.VS2005); } catch (Exception) { } timer1_Tick(null, null); timer1.Start(); }
private void importSetToolStripMenuItem_Click(object sender, EventArgs e) { var fileName = Dialogs.GetOpenGridRules(); if (fileName == null) { return; } var rules = Dialogs.LoadGridRules(fileName); Program.GridRules = rules; Extender.ReApplyGridRules(); }
private BackgroundWorker getExtenderWorker(Extender extender, string user, string pass) { var bw = new BackgroundWorker(); bw.DoWork += (s, e) => { var device = getDevice(extender.IP); device.DoReboot = extender.Restart; device.IsLoading = true; device.IsNetworkAccessible = extender.IsNetworkAccessible(); //if (device.IsNetworkAccessible) { var state = extender.GetState(); device.IsHttpAccessible = state.Accessible; device.IsAuthenticated = state.Authenticated; if (device.IsHttpAccessible == true) { if (!state.Authenticated) { var result = extender.Authenticate(user, pass); if (result == null) { device.IsAuthenticated = true; state = extender.GetState(); } } if (device.IsAuthenticated == true) { device.IsActive = state.IPConnStatus == Extender.DeviceState.ConnStatusEnum.Success; var speedFormat = "{0:N0}KBps | {1}"; device.RxSpeed = string.Format(speedFormat, state.AverageReceive / 1024, state.RxRate); device.TxSpeed = string.Format(speedFormat, state.AverageTransmit / 1024, state.TxRate); device.UpTime = state.ConnTime; device.Users.AddRange(state.Users.Select(u => new DeviceModel.UserInfo(u)), true); device.Throughputs.AddRange(extender.Throughputs, true); fillUsers(); autoExtenderReboot(device); this.Dispatcher.BeginInvoke(new Action(device.Users.ResetBindings), DispatcherPriority.Normal); } } } //RefreshButtons(); device.IsLoading = false; }; bw.RunWorkerCompleted += (s, e) => { OnPropertyChanged("Devices"); }; return(bw); }
private void WriteNodeLink(TreeView treeView, TreeNode item, HtmlTextWriter writer) { writer.WriteBeginTag("a"); if (!String.IsNullOrEmpty(item.NavigateUrl)) { writer.WriteAttribute("href", Extender.ResolveUrl(item.NavigateUrl)); } else { string codePrefix = ""; if (item.SelectAction == TreeNodeSelectAction.Select) { codePrefix = "s"; } else if (item.SelectAction == TreeNodeSelectAction.SelectExpand) { codePrefix = "e"; } else if (item.PopulateOnDemand) { codePrefix = "p"; } writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(treeView, codePrefix + (Page.Server.HtmlEncode(item.ValuePath)).Replace("/", "\\"), true)); } WebControlAdapterExtender.WriteTargetAttribute(writer, item.Target); if (!String.IsNullOrEmpty(item.ToolTip)) { writer.WriteAttribute("title", item.ToolTip); } else if (!String.IsNullOrEmpty(treeView.ToolTip)) { writer.WriteAttribute("title", treeView.ToolTip); } writer.Write(HtmlTextWriter.TagRightChar); writer.Indent++; writer.WriteLine(); WriteNodeImage(treeView, item, writer); char[] separator = { '|' }; string[] strings = item.Text.Split(separator); writer.Write(strings[0]); //writer.Write(item.Text); writer.Indent--; writer.WriteEndTag("a"); }
private void WriteContinuePanel(HtmlTextWriter writer, CreateUserWizard wizard) { string id = "ContinueButton"; string idWithType = WebControlAdapterExtender.MakeIdWithButtonType(id, wizard.ContinueButtonType); Control btn = wizard.FindControl("CompleteStepContainer").FindControl(idWithType); if (btn != null) { Page.ClientScript.RegisterForEventValidation(btn.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-CreateUserWizard-ContinuePanel"); Extender.WriteSubmit(writer, wizard.ContinueButtonType, wizard.ContinueButtonStyle.CssClass, "CompleteStepContainer_ContinueButton", wizard.ContinueButtonImageUrl, "", wizard.ContinueButtonText); WebControlAdapterExtender.WriteEndDiv(writer); } }
private void WriteEmailPanel(HtmlTextWriter writer, CreateUserWizard wizard) { TextBox textBox = wizard.FindControl("CreateUserStepContainer").FindControl("Email") as TextBox; if (textBox != null) { Page.ClientScript.RegisterForEventValidation(textBox.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-CreateUserWizard-EmailPanel"); Extender.WriteTextBox(writer, false, wizard.LabelStyle.CssClass, wizard.EmailLabelText, wizard.TextBoxStyle.CssClass, "CreateUserStepContainer_Email", ""); WebControlAdapterExtender.WriteRequiredFieldValidator(writer, wizard.FindControl("CreateUserStepContainer").FindControl("EmailRequired") as RequiredFieldValidator, wizard.ValidatorTextStyle.CssClass, "Email", wizard.EmailRequiredErrorMessage); WebControlAdapterExtender.WriteEndDiv(writer); } }
public override void ExitExtension([NotNull] LanguageParser.ExtensionContext context) { List <object> values = new List <object>(); object currentElement = stack.Pop(); while (!currentElement.Equals(enter.EnterExtension)) { values.Add(currentElement); currentElement = stack.Pop(); } stack.Push(Extender.extend(values[2], values[0], ((ParserTypes.Extender)values[1]).name)); }
public void PurgeDb() { try { Extender.RegisterType <Point, PointSerializer>(2000); } catch { } using (var i = Prepare()) i.Purge(); db = Prepare(); table = db.Table <IData>(); }
public WorldStorage() { _blocks = new Dictionary <long, TileBlock>(); _objects = new Dictionary <long, List <GameObject> >(); _blocksDb.Map <TileBlock>().Automap(x => x.Id); _objectsDb.Map <GameObject>().Automap(x => x.Id); Extender.RegisterType <ObjectType, TypeSerializers>(1000); _blocksDb.Initialize(); _objectsDb.Initialize(); Load(); }
public PanAndTiltController(Extender extender, uint pwmPulsePeriod) { if (extender == null) { throw new ApplicationException("pwm extender not set up correctly"); } _pwmPulsePeriod = pwmPulsePeriod; PanPwm = extender.SetupPWMOutput(GT.Socket.Pin.Seven); TiltPwm = extender.SetupPWMOutput(GT.Socket.Pin.Eight); Pan = PanCenter; Tilt = TiltCenter; SetPan(); SetTilt(); }
public static void SetSchema(DockPanel dockPanel, Extender.Schema schema) { if (schema == @Extender.Schema.Default) { dockPanel.Extender.AutoHideTabFactory = null; dockPanel.Extender.DockPaneTabFactory = null; dockPanel.Extender.AutoHideStripFactory = null; dockPanel.Extender.DockPaneCaptionFactory = null; dockPanel.Extender.DockPaneStripFactory = null; } else if (schema == Extender.Schema.Override) { dockPanel.Extender.AutoHideTabFactory = null; dockPanel.Extender.DockPaneTabFactory = null; dockPanel.Extender.DockPaneCaptionFactory = null; dockPanel.Extender.AutoHideStripFactory = new AutoHideStripOverrideFactory(); dockPanel.Extender.DockPaneStripFactory = new DockPaneStripOverrideFactory(); } else if (schema == Extender.Schema.FromBase) { dockPanel.Extender.AutoHideTabFactory = new AutoHideTabFromBaseFactory(); dockPanel.Extender.DockPaneTabFactory = new DockPaneTabFromBaseFactory(); dockPanel.Extender.AutoHideStripFactory = new AutoHideStripFromBaseFactory(); dockPanel.Extender.DockPaneCaptionFactory = new DockPaneCaptionFromBaseFactory(); dockPanel.Extender.DockPaneStripFactory = new DockPaneStripFromBaseFactory(); } }