public ControlHost(MsgManager msgMng,double width = 960, double height = 540) { m_msgMng = msgMng; m_hostWidth = (int)width; m_hostHeight = (int)height; //(PresentationSource.FromVisual(this) as System.Windows.Interop.HwndSource).AddHook(new System.Windows.Interop.HwndSourceHook(WndProc)); }
public MainWindow() { s_pW = this; Project.Setting.s_skinPath = ""; Project.Setting.s_projPath = ""; m_msgMng = new MsgManager(true); m_mapIncludeFiles = new Dictionary<string, IncludeFile>(); m_mapOpenedFiles = new Dictionary<string, OpenedFile>(); m_strDic = new StringDic("zh-CN", conf_pathStringDic); m_isCanEdit = true; m_tLast = 0; m_hitCount = 0; mx_skinEditor = new SkinEditor(); mt_status0 = ""; mt_status1 = ""; mt_status2 = ""; mt_status3 = ""; //system("taskkill /im conhost.exe /f"); InitializeComponent(); initData(); OpenedFile.s_paraResult = new Paragraph(); ResultLink.s_curResultFrame = OpenedFile.s_paraResult; m_isLoadOver = true; this.DataContext = this; mb_status0 = "就绪"; m_screenWidth = 960; m_screenHeight = 540; m_isMoba = false; m_screenWidthBasic = 960; m_screenHeightBasic = 540; m_dpiSysX = 96.0f; m_dpiSysY = 96.0f; m_curFile = ""; m_vCtrlName = true; m_vCtrlId = true; m_mapXeSel = new Dictionary<XmlElement, BoloUI.SelButton>(); mx_treeFrame.Items.Add(mx_skinEditor); m_xdTest = new XmlDocument(); // w=\"400\" h=\"300\" m_strTestXml = "<label dock=\"4\" baseID=\"testCtrl\" text=\"测试Test\"/>"; m_xdTest.LoadXml(m_strTestXml); m_xeTest = m_xdTest.DocumentElement; checkAndInitToolConfig(); // hook keyboard 可能会报毒 // IntPtr hModule = GetModuleHandle(IntPtr.Zero); // hookProc = new LowLevelKeyboardProcDelegate(LowLevelKeyboardProc); // hHook = SetWindowsHookEx(WH_KEYBOARD_LL, hookProc, hModule, 0); // if (hHook == IntPtr.Zero) // { // MessageBox.Show("Failed to set hook, error = " + Marshal.GetLastWin32Error()); // } return; TcpListener server = new TcpListener(new System.Net.IPEndPoint(IPAddress.Parse("10.0.6.10"), 10088)); server.Start(100); tcpClientConnected.Reset(); IAsyncResult result = server.BeginAcceptTcpClient(new AsyncCallback(Acceptor), server); tcpClientConnected.WaitOne(); }
private void mx_root_Loaded(object sender, RoutedEventArgs e) { HwndSource source = PresentationSource.FromVisual(this) as HwndSource; if (source != null) { source.AddHook(WndProc); } m_msgMng = new MsgManager(false, m_screenWidth, m_screenHeight); mx_GLCtrl.Child = m_msgMng.m_GLHost; m_msgMng.m_GLHost.MessageHook += new HwndSourceHook(ControlMsgFilter); if (m_isDebug) { mx_debugTools.Visibility = System.Windows.Visibility.Visible; } else { mx_debugTools.Visibility = System.Windows.Visibility.Collapsed; } MainWindow.s_pW.showGLCtrl(false); m_textTimer = new DispatcherTimer(); m_textTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); m_textTimer.Tick += new EventHandler(m_textTimer_Tick); m_textTimer.Start(); m_fileChangeTimer = new DispatcherTimer(); m_fileChangeTimer.Interval = new TimeSpan(0, 0, 0, 0, 1000); m_fileChangeTimer.Tick += new EventHandler(m_fileChangeTimer_Tick); m_fileChangeTimer.Start(); }