/// <summary> /// Load the iges format of the body from the stream /// </summary> /// <param name="stream"></param> /// <returns></returns> public static List <IBody2> LoadBodiesAsIges(Stream stream) { var igesFile = GetTempFilePathWithExtension(ExportGeometryFileExtension); LogViewer.Log($"Loading iges file {igesFile} into Solidworks"); using (var ostream = File.OpenWrite(igesFile)) { stream.CopyTo(ostream); } var doc = SwAddinBase.Active.SwApp.LoadIgesInvisible(igesFile); try { var newPartDoc = (PartDoc)doc; Debug.Assert(newPartDoc != null); var loadedBody = newPartDoc.GetBodies2((int)swBodyType_e.swAllBodies, false).CastArray <IBody2>().ToList(); Debug.Assert(loadedBody.Count > 0); return(loadedBody.Select(p => p.CopyTs()).ToList()); } finally { SwAddinBase.Active.SwApp.QuitDoc(doc.GetTitle()); } }
public static string TryCreateScreenshot(LogViewer logViewer) { try { Window win = logViewer; RenderTargetBitmap bmp = new RenderTargetBitmap((int)win.Width, (int)win.Height, 96, 96, PixelFormats.Pbgra32); bmp.Render(win); string PicPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Picture"); if (!Directory.Exists(PicPath)) { Directory.CreateDirectory(PicPath); } BitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bmp)); string filePath = Path.Combine(PicPath, string.Format("{0:MMddyyyyHHmmss}.png", DateTime.Now)); using (Stream stream = File.Create(filePath)) { encoder.Save(stream); } return(Path.GetFullPath(filePath)); } catch (System.Exception ex) { Logger.Log(ex); Failed = true; } return(string.Empty); }
private static void WriteLog(string log) { if (IsConsole) { Console.WriteLine(FormatLog(log)); } if (LogViewer == null) { throw new NullReferenceException("LogViewer is not set."); } LogViewer.Log(FormatLog(log)); //try //{ // if (CacheLogs.Count > 0) //try to write failed log first // { // File.AppendAllLines(LogPath, CacheLogs, Encoding.UTF8); // CacheLogs.Clear(); // } // //write new log // File.AppendAllLines(LogPath, new List<string> {FormatLog(log)}, Encoding.UTF8); //} //catch (UnauthorizedAccessException) //{ // CacheLogs.Add("UnauthorizedAccessException -> store log to try later."); // CacheLogs.Add(FormatLog(log)); // //cache message to try later //} }
private bool CompileGame() { string projectFile = $@"{ProjectPath}\Empty.sln -flp:logfile=MyProjectOutput.log;verbosity=diagnostic"; string projectExe = $@"{ProjectPath}\Empty\bin\Debug\Empty.exe"; string strCmdText = $@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe {projectFile} -t:go -fl -flp:logfile=MyProjectOutput.log;verbosity=diagnostic"; try { File.Delete(projectExe); } catch { } var p = new Process(); p.StartInfo = new ProcessStartInfo(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"); p.StartInfo.Arguments = string.Format(projectFile); p.Start(); p.WaitForExit(); try { Process.Start(projectExe); } catch { MessageBox.Show("An error is occuperd, please check your code!"); LogViewer logViewer = new LogViewer(); logViewer.Text = $"Log View for {ProjectPath}"; logViewer.Show(); return(false); } return(true); }
void OnClickSendFeedBack(GameObject go) { if (isFeedBackClicked) { return; } if (!Utility.Input.IsStringValid(txtContent.value, 10, 999999)) { NotificationView.ShowMessage("Nội dung bạn gửi quá ngắn.\n\nHãy nhập một lời góp ý trên 10 ký tự", 3f); return; } ServerWeb.StartThread(ServerWeb.URL_SEND_FEEDBACK, new object[] { "game_id", (int)GameManager.GAME, "user_id", GameManager.Instance.mInfo.id, "title", txtTitle.value, "content", txtContent.value }, CallBackResponse); if (CBSendLog.value == true) { //LogViewer.SaveLogToFile();//for test LogViewer.SendLogToServer(); CBSendLog.value = false; //Debug.LogWarning("Đã gửi debug_log"); } isFeedBackClicked = true; }
public async Task CanRebuildSelected() { var modelDoc = (IModelDoc2)SwApp.ActiveDoc; var surface = modelDoc .GetBodiesTs(swBodyType_e.swSolidBody)[0]; // Copy the original surface var surfaceCopy = surface.CopyTs(); // Temporarily hide the original surface so the model viewport is clear using (surface.HideBodyUndoable()) { // Display the copy so the tester can visually verify it is ok. // Press "Continue Test Execution" button within solidworks // to continue the test after visual inspection of the sheet using (surfaceCopy.DisplayUndoable(modelDoc, Color.Green)) await PauseTestExecution(); // The sheet should only have one face. Extract it IFace2[] faces = surfaceCopy.GetFaces().CastArray <IFace2>(); // Convert the solidworks face to our representation List <BSplineFace> bsplineFaces = faces .Select(BSplineFace.Create) .ToList(); var bsplineFacesJson = JsonConvert.SerializeObject(bsplineFaces, Formatting.Indented); // you can now paste this into your favorite editor copy_to_clipboard(bsplineFacesJson); LogViewer.Log("JSON of bsplineFaces is now in clipboard"); // Convert our representation back to an IBody2. We // have used Option<T> wrappers to indicate failure // or success for each conversion. List <Option <IBody2> > faceBodies = bsplineFaces .Select(bsplineFace => bsplineFace.ToSheetBody()) .ToList(); // Count the number of faces that were not able to // be converted from bspline surface to IBody2 int numberOfBadFaces = faceBodies.Count(b => b.IsNone); LogViewer.Log($"Number of bad faces is {numberOfBadFaces}"); // Display the recovered sheet. Visually verify it is ok // Press "Continue Test Execution" button within solidworks // to continue the test after visual inspection of the sheet using (faceBodies.WhereIsSome().DisplayUndoable(modelDoc, Color.Blue)) await PauseTestExecution(); // Assert that the test has passed. numberOfBadFaces.Should().Be(0); } }
private static int GreatLimit; // いつまで派手にするのか public Echo(LogViewer _viewer) { Viewer = _viewer; GreatLimit = 0; SendQ = new Queue <EffectData>(); RecvQ = new Queue <EffectData>(); }
public void Execute() { Helpers.AssertOnUiThread(); var viewer = new LogViewer(string.Join("\n", Log.History.Select(l => l.ToString()))); viewer.ShowDialog(); }
/// <summary> /// 只进行提示 /// </summary> public static void Tip(string tip, TipType tt = TipType.Normal) { SetConsole(tip); OnTip?.Invoke(tt, tip); LogViewer?.ShowTip(tip); }
private void OnLogViewer(object sender, EventArgs e) { LogViewer logViewer = new LogViewer(); logViewer.ShowDialog(); logViewer.Close(); logViewer.Dispose(); }
static void Init() { // build the log viewer window and set title LogViewer window = ( LogViewer )EditorWindow.GetWindow(typeof(LogViewer)); window.title = "Log Viewer"; logWatch = null; }
private void ShowLogViewer() { ILogReader reader = LoggerFactory.MakeTextReader(_logWriter.Path); LogViewerViewModel vm = new LogViewerViewModel(reader); LogViewer viewer = new LogViewer(); viewer.DataContext = vm; viewer.ShowDialog(); }
public static void Show(this Exception e) { // Exceptions viewer must be shown on STA thread. LogViewer.Invoke(() => { var exceptionReporter = new ExceptionReporting.ExceptionReporter(); exceptionReporter.Show(e); }); }
private void Button_Click(object sender, RoutedEventArgs e) { if (isFinding) { return; } findButton.Content = "正在查找..."; findButton.IsEnabled = false; isFinding = true; LogLabel.Text = "正在查找...\n"; killAllFindThread(); resetClinet(); string localIp = GetLocalIP(); Console.WriteLine(localIp); string ipPre = localIp.Substring(0, localIp.LastIndexOf('.') + 1); new Thread(() => { for (int i = 0; i <= 255; i++) { string para = ipPre + i.ToString(); Thread t1 = new Thread(new ParameterizedThreadStart(findConnect)); t1.IsBackground = true; threadList.Add(t1); t1.Start(para); t1.Priority = ThreadPriority.BelowNormal; Thread.Sleep(50); //findConnect(para); } }).Start(); listView.ItemsSource = androidClientList; Console.WriteLine("!!!!*******************$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); new Thread(() => { TimeSpan ts = new TimeSpan(0, 0, 1); for (int i = 23; i > 0; i--) { Thread.Sleep(ts); } UpdateFindButton updateFindButton = new UpdateFindButton(UpdateFindButtonUI); this.Dispatcher.Invoke(updateFindButton, true); }).Start(); installButton.IsEnabled = true; uninstallButton.IsEnabled = true; customButton.IsEnabled = true; LogViewer.ScrollToEnd(); }
public static void Open() { var logViewer = new LogViewer(); logViewer.Show(); // Avoid the log viewer blocking the main window logViewer.Owner = null; logViewer.ShowInTaskbar = true; }
private void Redraw() { try { _ModelView.GraphicsRedraw(null); } catch (COMException e) { LogViewer.Log($"Exception was expected '{e.Message}' but logging it anyway"); } }
private void OpenIssues(object sender, RoutedEventArgs e) { MetroButton senderButton = (MetroButton)sender; AssemblyGenerationResult assemblyGenerationResult = (AssemblyGenerationResult)senderButton.Tag; LogViewer viewer = new LogViewer(); viewer.Log = assemblyGenerationResult.Log.LogData; viewer.Owner = App.MainWindow; viewer.Show(); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { logger = Find.Child <LogViewer>(Application.Current.MainWindow, "Logger"); // TODO: Переделать на реальную ширину окна при загрузке... IMG.TotalWidth = 820; // System IMG.UpdateImage(4, AmebaA_Addresses.SystemDataAddr, AmebaA_Addresses.SystemDataSize); // Calibration IMG.UpdateImage(5, AmebaA_Addresses.CalibrationDataAddr, AmebaA_Addresses.CalibrationDataSize); }
private Log() { timeSinceStart = Stopwatch.StartNew(); logView = new LogViewer(); file = new StreamWriter(Environment.CurrentDirectory + "\\log.txt", false); file.AutoFlush = true; logView = new LogViewer(); if (file != null) { PrintInfo(); } }
private void AppendLog(string str, bool newline = true) { if (newline) { str += "\r"; } Dispatcher.Invoke(new Action(() => { LogViewer.AppendText(str); LogViewer.ScrollToEnd(); })); }
private void OpenIssues(object sender, RoutedEventArgs e) { MetroButton senderButton = (MetroButton)sender; ImportTranslationResult importTranslationResult = (ImportTranslationResult)senderButton.Tag; string log = CreateLogFromResult(importTranslationResult.Log); LogViewer viewer = new LogViewer(); viewer.Title = StringUtils.String("ImportTranslationLogIssue", importTranslationResult.RelativeFileName); viewer.Log = log; viewer.Owner = App.MainWindow; viewer.Show(); }
private void InitUserControls() { //Konvertiert das Original in Images und date DynBeleg up _bc = new BelegConverter(_sqls["TO_CONVERT"]) { Dock = DockStyle.Fill }; panel.Controls.Add(_bc); //Dyn_Beleg: Erstellt der Original Wert wieder her (Original == null, Anzall in der Regel =1) _ro = new RecoveryOriginal(_sqls["RECOVER_ORIGINAL"]) { Dock = DockStyle.Fill }; panel.Controls.Add(_ro); //Dyn_Beleg wird repariert (Original + Anzahl der Seite von Konvertierte Dokument) _co = new CheckForOriginal(_sqls["CHECK_DATA"]) { Dock = DockStyle.Fill }; panel.Controls.Add(_co); //Dyn_Beleg: setzt Seite = Anzahl der Seite von Konvertierte Dokument _cwo = new CheckWithoutOriginal(_sqls["CHECK_DATA_WIHTOUT_ORIGINAL"]) { Dock = DockStyle.Fill }; panel.Controls.Add(_cwo); // _ca = new CovertAgain(_sqls["CONVERT_AGAIN"]) { Dock = DockStyle.Fill }; panel.Controls.Add(_ca); _rbs = new RepairBelegSeiten(_sqls["REPAIR_BELEGSEITEN"]) { Dock = DockStyle.Fill }; panel.Controls.Add(_rbs); _lw = new LogViewer { Dock = DockStyle.Fill }; panel.Controls.Add(_lw); panel.Controls[0].Show(); }
public EmuDebugger() { bool setupOk = this.SetupRemoting(); Debug.Assert(setupOk == true); this.CallStacksEnabled = true; this.Breakpoints = new BreakpointManager(this); this.View = new DebugView(this); // Log is created here because it is special this.Log = new LogViewer(this); this.OnStateChanged(); }
void Awake() { instance = this; GameObject msgObject; for (int i = 0; i < maxMessage; i++) { msgObject = Instantiate(logMessage) as GameObject; msgObject.transform.SetParent(logContainer); msgObject.transform.localScale = Vector3.one; msgObject.GetComponentInChildren <Text>().text = ""; messageQueue.Enqueue(msgObject); } }
public Form1(MonitorSettings settings) { InitializeComponent(); MonitorLiteManager.HotKeyPress += MonitorLiteManager_HotKeyPress; tabControl2.SelectedIndexChanged += TabControl2_SelectedIndexChanged; SetUiSettings(settings); RestartMonitor(); logViewer = new LogViewer(); this.FormClosing += Form1_FormClosing; this.notifyIcon1.Icon = this.Icon; this.notifyIcon1.MouseDoubleClick += NotifyIcon1_MouseDoubleClick; this.Resize += Form1_Resize; }
public MainWindow() { Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(ExceptionHelper.HanldeUnhandledException); this.Model = new MainModel(App.CommandLineArgs, SynchronizationContext.Current); this.logwindow = new LogViewer(); this.logwindow.DataContext = this.Model; ExceptionHelper.logviewer = this.logwindow; this.EventsModel = new EventsModel(); this.FilterModel = new FilterModel(); this.TimelineModel = new TimelineModel(this.Model); this.EventStatsModel = new EventStatsModel(); Instance = this; InitializeComponent(); SystemCommandHandler.Bind(this); this.DataContext = this.Model; this.Loaded += MainWindow_Loaded; }
public void ShowLogs(params Tuple <Log, string>[] logs) { if (!Application.Current.Dispatcher.CheckAccess()) { Application.Current.Dispatcher.Invoke(() => ShowLogs(logs)); return; // Important to leave the culprit thread } if (logs == null) { throw new ArgumentException("This method should only be called using an Log array"); } foreach (Tuple <Log, string> tup in logs) { var l = tup.Item1; var view = new LogViewer(l.vert, l.steps, tup.Item2); view.Show(); } }
public FeedHandlerConfigWindowViewModel(LogViewer logViewer) { AddItem = ReactiveCommand.Create(() => Feeds.Add( new FeedHandlerConfig { CheckEveryMinutes = 15, Regex = ".*" })); DelItem = ReactiveCommand.Create <string>(url => Feeds.Remove(Feeds.First(f => f.Url == url))); SaveItems = ReactiveCommand.Create(async() => { await Helpers.SaveConfigFile <FeedHandler>(Feeds.ToList()); CloseWindow.OnNext(true); }); Cancel = ReactiveCommand.Create(() => CloseWindow.OnNext(false)); ViewLogs = ReactiveCommand.Create(async() => { if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { var window = new Window { Height = 400, Width = 1200, Content = logViewer }; await window.ShowDialog(desktop.MainWindow); } }); var config = Helpers.GetConfig <FeedHandler, List <FeedHandlerConfig> >(); if (config.Count == 0) { AddItem.Execute().Subscribe(); } else { config.ForEach(c => Feeds.Add(c)); } }
private void ExecuteOpenLogCommand(bool isStartScript) { LogViewerViewModel vm = new LogViewerViewModel(); if (isStartScript) { vm.Log = LastStartScriptExecutionStatus.Log; vm.Title = "Last StartScript execution log"; vm.WasSuccess = LastStartScriptExecutionStatus.WasSuccess; } else { vm.Log = LastStopScriptExecutionStatus.Log; vm.Title = "Last StopScript execution log"; vm.WasSuccess = LastStopScriptExecutionStatus.WasSuccess; } var window = new LogViewer(); window.DataContext = vm; window.ShowDialog(); }
private async Task BaseApp_StartupComplete_Miscellaneous_Async(object sender, EventArgs eventArgs) { if (Dispatcher == null) { throw new Exception("Dispatcher is null"); } // Run on UI thread await Dispatcher.Invoke(async() => { // Show log viewer if a debugger is attached if (Debugger.IsAttached) { var logViewer = new LogViewer(); var win = await logViewer.ShowWindowAsync(); // NOTE: This is a temporary solution to avoid the log viewer blocking the main window win.Owner = null; win.ShowInTaskbar = true; MainWindow?.Focus(); } }); }
public MainForm(Account account) { InitializeComponent(); this.account = account; notificationSender = new NotificationSender(); NotificationSender.LoginedEmployee = account; notificationSender.FormClosed += (sender, e) => Close(); InitializeButtonList(notificationSender); templateCreator = new TemplateCreator(); TemplateCreator.LoginedEmployee = account; templateCreator.FormClosed += (sender, e) => Close(); InitializeButtonList(templateCreator); logViewer = new LogViewer(); LogViewer.LoginedEmployee = account; logViewer.FormClosed += (sender, e) => Close(); InitializeButtonList(logViewer); defaultForm = notificationSender; ShowInTaskbar = false; }