//实例化Timer类,设置间隔时间为10000毫秒; public void theout(object source, System.Timers.ElapsedEventArgs e) { while (true) { IGCore.RenderFrame(); } }
private void wfHost_ChildChanged(object sender, System.Windows.Forms.Integration.ChildChangedEventArgs e) { IntPtr hwnd = viewport.Handle; double h = this.wfHost.Height; double w = this.wfHost.Width; IGCore.InitD3D(hwnd, w, h); }
private void wfHost_ChildChanged(object sender, System.Windows.Forms.Integration.ChildChangedEventArgs e) { IntPtr hwnd = viewport.Handle; double h = this.wfHost.Height; double w = this.wfHost.Width; IGCore.InitD3D(hwnd, w, h); t.Elapsed += new System.Timers.ElapsedEventHandler(theout); //到达时间的时候执行事件; t.AutoReset = false; //设置是执行一次(false)还是一直执行(true); t.Enabled = true; //需要调用 timer.Start()或者timer.Enabled = true来启动它, timer.Start()的内部原理还是设置timer.Enabled = true; }
private void OpenProject(object sender, RoutedEventArgs e) { // Create OpenFileDialog Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); // Set filter for file extension and default file extension dlg.DefaultExt = ".gproj"; dlg.Filter = "GE Project Files (*.gproj)|*.gproj"; // Display OpenFileDialog by calling ShowDialog method Nullable <bool> result = dlg.ShowDialog(); // Get the selected file name and display in a TextBox if (result == true) { // Open document string filename = dlg.FileName; mProjectName = System.IO.Path.GetFileNameWithoutExtension(filename); fileBrowser.SetWorkDirectory(System.IO.Path.GetDirectoryName(filename) + @"\"); fileBrowser.LoadBrowser(); IGCore.SetWorkDirectory(System.IO.Path.GetDirectoryName(filename) + @"\"); IGCore.SetProjectName(System.IO.Path.GetFileNameWithoutExtension(filename)); IntPtr hwnd = viewport.Handle; double h = viewport.Height; double w = viewport.Width; IGCore.InitD3D(hwnd, w, h); IGCore.SetSelectSceneObjectCallback(SelectSceneObject); IGCore.SetRefreshSceneObjectTransformCallback(RefreshTransform); outliner.GetSceneObjects(); IGCore.Run(); } }
private void SaveProject(object sender, RoutedEventArgs e) { IGCore.SaveProject(); }
private void Button_Click(object sender, RoutedEventArgs e) { IGCore.RenderFrame(); }