This repository has been archived by the owner on Jan 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from GDKsoftware/41
41
- Loading branch information
Showing
16 changed files
with
281 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Window x:Name="FrmLogging" x:Class="GitBitterEdit.LoggingForm" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:GitBitterEdit" | ||
mc:Ignorable="d" | ||
Title="Logging" Height="300" Width="300"> | ||
<Grid> | ||
<ListBox x:Name="listBox"/> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace GitBitterEdit | ||
{ | ||
/// <summary> | ||
/// Interaction logic for LoggingForm.xaml | ||
/// </summary> | ||
public partial class LoggingForm : Window | ||
{ | ||
public LoggingForm() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public void SetList(IEnumerable ASource) | ||
{ | ||
listBox.ItemsSource = null; | ||
listBox.ItemsSource = ASource; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
namespace GitBitterEdit | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using GitBitterLib; | ||
using System.Threading; | ||
using System.Windows; | ||
|
||
public class LoggingUI : IGitBitterLogging | ||
{ | ||
private LoggingForm form = null; | ||
private List<string> collectedLogging = null; | ||
private TaskScheduler mainThreadScheduler = null; | ||
|
||
public LoggingUI(TaskScheduler AMainThreadScheduler) | ||
{ | ||
collectedLogging = new List<string>(); | ||
|
||
mainThreadScheduler = AMainThreadScheduler; | ||
|
||
form = new LoggingForm(); | ||
|
||
Application.Current.MainWindow.Closed += (object sender, EventArgs e) => | ||
{ | ||
if (form != null) form.Close(); | ||
}; | ||
} | ||
|
||
private void ExecuteInMainContext(Action action) | ||
{ | ||
Task task = new Task(action); | ||
task.Start(mainThreadScheduler); | ||
} | ||
|
||
public void Add(string AMessage, LoggingLevel ALevel, string AModule) | ||
{ | ||
collectedLogging.Add("[" + AModule + "] " + AMessage.Trim()); | ||
|
||
ExecuteInMainContext(() => | ||
{ | ||
if (!form.IsVisible) | ||
{ | ||
try | ||
{ | ||
form.Show(); | ||
} | ||
catch (Exception) | ||
{ | ||
form = new LoggingForm(); | ||
form.Show(); | ||
} | ||
} | ||
form.SetList(collectedLogging); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
namespace GitBitterLib | ||
{ | ||
using System; | ||
public class GitBitterLoggingVoid : IGitBitterLogging | ||
{ | ||
public GitBitterLoggingVoid() | ||
{ | ||
} | ||
|
||
public class GitBitterLoggingVoid : IGitBitterLogging | ||
{ | ||
public GitBitterLoggingVoid() | ||
{ | ||
} | ||
|
||
public void Add(string AMessage, LoggingLevel ALevel) | ||
{ | ||
} | ||
} | ||
public void Add(string message, LoggingLevel level, string module) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.