public TesterPage(MainWindow mainWindow, HostHandler handler) { InitializeComponent(); this.handler = handler; this.mainWindow = mainWindow; this.TFirmwareVersion.Content = handler.firmwareVersion; }
/// <summary> /// Adds a handler for a given Origin. /// </summary> /// <param name="origin">The origin to whom requests are routed to.</param> /// <param name="handler">The handler for requests to the specified origin.</param> public void AddHandler(Origin origin, HttpMessageHandler handler) { var endpoint = new HostHandler(handler); var host = $"{origin.Host}:{origin.Port}"; _hosts.Add(host, endpoint); }
public MainWindow(HostHandler handler) { try { InitializeComponent(); handler.execute(Command.GetFirmwareVersion, new float[0]); var testPage = new TesterPage(this, handler); var userPage = new UserPage(this, handler); testPage.SetUserPage(userPage); userPage.setTesterPage(testPage); MainView.Child = userPage; } catch (Exception e) { System.Console.WriteLine(e.StackTrace); } }
private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { try { //treeView1.SuspendLayout(); //treeView1.BeginUpdate(); //treeView1.DrawMode = TreeViewDrawMode.Normal; Config.LastPath = txtPath.Text; HostHandler.ReleaseAssemblyResolver(); } catch { #if DEBUG throw; #endif } }
private void frmMain_Load(object sender, EventArgs e) { PluginHandler.LoadPlugins(); ToolHandler.LoadTools(); //put this after loadplugins to avoid "where's reflector" dialog HostHandler.SetupAssemblyResolver(); #region About & Update try { ShowAbout(false); CheckUpdate(); } catch (Exception ex) { SimpleMessage.ShowException(ex); } #endregion About & Update }
public object GetPropertyValue(string propertyName) { return(HostHandler.GetPropertyValue(propertyName)); }
public void SetPropertyValue(string propertyName, object value) { HostHandler.SetPropertyValue(propertyName, value); }
public void RemoveProperty(string propertyName) { HostHandler.RemoveProperty(propertyName); }
public bool AddProperty(string propertyName, object defaultValue, Type propertyType) { return(HostHandler.AddProperty(propertyName, defaultValue, propertyType)); }
public void ResetProgress() { HostHandler.ResetProgress(); }
public void RegisterHostHandler(string host, HostHandler handler) { HostHandlers[host] = handler; }
public void ParseGcode(Stream file, HostHandler handler) { try { //List<List<string>> listOfG = new List<List<string>>(); var g1 = "G1"; var g92 = "G92"; var lineCounter = -1; using (var sr = new StreamReader(file)) { Console.WriteLine("Start Parsing"); while (!sr.EndOfStream) { //List<string> GLine = new List<string>(); lineCounter++; var line = sr.ReadLine(); if (String.IsNullOrEmpty(line)) { continue; } if (line.IndexOf(g1, StringComparison.CurrentCultureIgnoreCase) >= 0) { var eachLine = line.Split(' '); var xString = Array.FindAll(eachLine, x => x.StartsWith("X")); var yString = Array.FindAll(eachLine, x => x.StartsWith("Y")); var eString = Array.FindAll(eachLine, x => x.StartsWith("E")); var zString = Array.FindAll(eachLine, x => x.StartsWith("Z")); if ((xString != null && xString.Length != 0) && (yString != null && yString.Length != 0)) { var xFloat = float.Parse(xString.First().Substring(1)); var yFloat = float.Parse(yString.First().Substring(1)); handler.execute(Command.MoveGalvonometer, new float[] { xFloat * 0.025f, yFloat * 0.025f }); } if (zString != null && zString.Length != 0) { handler.execute(Command.StepStepper, new float[] { 1f }); } if (eString != null && eString.Length != 0) { var eFloat = float.Parse(eString.First().Substring(1)); if (eFloat == 0f) { handler.execute(Command.SetLaser, new float[] { 0f }); } else { handler.execute(Command.SetLaser, new float[] { 1f }); } } } else if (line.IndexOf(g92, StringComparison.CurrentCultureIgnoreCase) >= 0) { handler.execute(Command.SetLaser, new float[] { 0f }); } } Console.WriteLine("End Parsing"); } } catch (Exception e) { System.Console.WriteLine(e.StackTrace); } }
public void InitProgress(int min, int max) { HostHandler.InitProgress(min, max); }
public void SetStatusText(string info, bool doEvents) { HostHandler.SetStatusText(info, doEvents); }
public void SetStatusText(string info) { HostHandler.SetStatusText(info); }
public bool AddAssemblyResolveDir(string dir) { return(HostHandler.AddAssemblyResolveDir(dir)); }
public bool RemoveAssemblyResolveDir(string dir) { return(HostHandler.RemoveAssemblyResolveDir(dir)); }
public void SetProgress(int val) { HostHandler.SetProgress(val); }
public void SetProgress(int val, bool doEvents) { HostHandler.SetProgress(val, doEvents); }
/// <summary> /// this is done just once, to globally initialize CefSharp/CEF /// </summary> private void InitBrowser() { CefSettings settings = new CefSettings(); settings.Locale = "zh_CN"; settings.CachePath = System.IO.Directory.GetCurrentDirectory() + @"/BrowserCache"; settings.AcceptLanguageList = "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3"; settings.LocalesDirPath = System.IO.Directory.GetCurrentDirectory() + @"/localeDir"; settings.LogFile = System.IO.Directory.GetCurrentDirectory() + @"/LogData"; settings.PersistSessionCookies = true; settings.UserDataPath = System.IO.Directory.GetCurrentDirectory() + @"/UserData"; settings.UserAgent = UserAgent; settings.IgnoreCertificateErrors = true; Cef.Initialize(settings); dHandler = new DownloadHandler(this); lHandler = new LifeSpanHandler(this); mHandler = new ContextMenuHandler(this); kHandler = new KeyboardHandler(this); rHandler = new RequestHandler(this); host = new HostHandler(this); AddNewBrowser(CefFaTabStripItem, HomepageURL); }