-
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.
proj: FontAwesome.Wpf : icons from http://www.fontawesome.com.cn/ proj: MapEditor.Controls : custom controls for mapeditor proj: MapEditor.Grpc : grpc base model proj: MapEditor.Grpc.Server : grpc server impl proj: MapEditor.Models : models in solution proj: MapEditor.WpfShell : UI of mapeditor
- Loading branch information
Showing
60 changed files
with
4,793 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
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,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net472</TargetFramework> | ||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="FontAwesome\fontawesome-webfont.ttf" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Resource Include="FontAwesome\fontawesome-webfont.ttf" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
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,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
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,227 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Threading; | ||
|
||
namespace MapEditor.Controls | ||
{ | ||
/// <summary> | ||
/// BusyIndicator | ||
/// </summary> | ||
[StyleTypedProperty(Property = "ProgressBarStyle", StyleTargetType = typeof(ProgressBar))] | ||
[StyleTypedProperty(Property = "OverlayStyle", StyleTargetType = typeof(Rectangle))] | ||
[TemplateVisualState(Name = "Hidden", GroupName = "VisibilityStates")] | ||
[TemplateVisualState(Name = "Visible", GroupName = "VisibilityStates")] | ||
[TemplateVisualState(Name = "Idle", GroupName = "BusyStatusStates")] | ||
[TemplateVisualState(Name = "Busy", GroupName = "BusyStatusStates")] | ||
public class BusyIndicator : ContentControl | ||
{ | ||
private DispatcherTimer m_DisplayAfterTimer; | ||
|
||
#region DependencyProperties | ||
|
||
public static readonly DependencyProperty IsBusyProperty = | ||
DependencyProperty.Register( | ||
"IsBusy", | ||
typeof(bool), | ||
typeof(BusyIndicator), | ||
new PropertyMetadata(false, new PropertyChangedCallback(OnIsBusyChanged))); | ||
|
||
public static readonly DependencyProperty BusyContentProperty = | ||
DependencyProperty.Register( | ||
"BusyContent", | ||
typeof(object), | ||
typeof(BusyIndicator), | ||
new PropertyMetadata(null)); | ||
|
||
public static readonly DependencyProperty BusyContentTemplateProperty = | ||
DependencyProperty.Register( | ||
"BusyContentTemplate", | ||
typeof(DataTemplate), | ||
typeof(BusyIndicator), | ||
new PropertyMetadata(null)); | ||
|
||
public static readonly DependencyProperty DisplayAfterProperty = | ||
DependencyProperty.Register( | ||
"DisplayAfter", | ||
typeof(TimeSpan), | ||
typeof(BusyIndicator), | ||
new PropertyMetadata(TimeSpan.FromSeconds(0.1))); | ||
|
||
public static readonly DependencyProperty OverlayStyleProperty = | ||
DependencyProperty.Register( | ||
"OverlayStyle", | ||
typeof(Style), | ||
typeof(BusyIndicator), | ||
new PropertyMetadata(null)); | ||
|
||
public static readonly DependencyProperty ProgressBarStyleProperty = | ||
DependencyProperty.Register( | ||
"ProgressBarStyle", | ||
typeof(Style), | ||
typeof(BusyIndicator), | ||
new PropertyMetadata(null)); | ||
|
||
#endregion | ||
|
||
#region Properties | ||
|
||
protected bool IsContentVisible | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
public bool IsBusy | ||
{ | ||
get | ||
{ | ||
return (bool)GetValue(IsBusyProperty); | ||
} | ||
set | ||
{ | ||
SetValue(IsBusyProperty, value); | ||
} | ||
} | ||
|
||
public object BusyContent | ||
{ | ||
get | ||
{ | ||
return GetValue(BusyContentProperty); | ||
} | ||
set | ||
{ | ||
SetValue(BusyContentProperty, value); | ||
} | ||
} | ||
|
||
public DataTemplate BusyContentTemplate | ||
{ | ||
get | ||
{ | ||
return (DataTemplate)GetValue(BusyContentTemplateProperty); | ||
} | ||
set | ||
{ | ||
SetValue(BusyContentTemplateProperty, value); | ||
} | ||
} | ||
|
||
public TimeSpan DisplayAfter | ||
{ | ||
get | ||
{ | ||
return (TimeSpan)GetValue(DisplayAfterProperty); | ||
} | ||
set | ||
{ | ||
SetValue(DisplayAfterProperty, value); | ||
} | ||
} | ||
|
||
public Style OverlayStyle | ||
{ | ||
get | ||
{ | ||
return (Style)GetValue(OverlayStyleProperty); | ||
} | ||
set | ||
{ | ||
SetValue(OverlayStyleProperty, value); | ||
} | ||
} | ||
|
||
public Style ProgressBarStyle | ||
{ | ||
get | ||
{ | ||
return (Style)GetValue(ProgressBarStyleProperty); | ||
} | ||
set | ||
{ | ||
SetValue(ProgressBarStyleProperty, value); | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
#region Constructors | ||
|
||
static BusyIndicator() | ||
{ | ||
DefaultStyleKeyProperty.OverrideMetadata(typeof(BusyIndicator), new FrameworkPropertyMetadata(typeof(BusyIndicator))); | ||
} | ||
|
||
public BusyIndicator() | ||
{ | ||
m_DisplayAfterTimer = new DispatcherTimer(); | ||
Loaded += delegate | ||
{ | ||
m_DisplayAfterTimer.Tick += new EventHandler(DisplayAfterTimerElapsed); | ||
}; | ||
Unloaded -= delegate | ||
{ | ||
m_DisplayAfterTimer.Tick -= new EventHandler(DisplayAfterTimerElapsed); | ||
m_DisplayAfterTimer.Stop(); | ||
}; | ||
} | ||
|
||
#endregion | ||
|
||
#region Overrides | ||
|
||
public override void OnApplyTemplate() | ||
{ | ||
base.OnApplyTemplate(); | ||
ChangeVisualState(false); | ||
} | ||
|
||
#endregion | ||
|
||
#region methods | ||
|
||
private void DisplayAfterTimerElapsed(object sender, EventArgs e) | ||
{ | ||
m_DisplayAfterTimer.Stop(); | ||
IsContentVisible = true; | ||
ChangeVisualState(true); | ||
} | ||
|
||
private static void OnIsBusyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
((BusyIndicator)d).OnIsBusyChanged(e); | ||
} | ||
|
||
protected virtual void OnIsBusyChanged(DependencyPropertyChangedEventArgs e) | ||
{ | ||
if (IsBusy) | ||
{ | ||
if (DisplayAfter.Equals(TimeSpan.Zero)) | ||
{ | ||
IsContentVisible = true; | ||
} | ||
else | ||
{ | ||
m_DisplayAfterTimer.Interval = DisplayAfter; | ||
m_DisplayAfterTimer.Start(); | ||
} | ||
} | ||
else | ||
{ | ||
m_DisplayAfterTimer.Stop(); | ||
IsContentVisible = false; | ||
} | ||
ChangeVisualState(true); | ||
} | ||
|
||
protected virtual void ChangeVisualState(bool useTransitions) | ||
{ | ||
VisualStateManager.GoToState(this, IsBusy ? "Busy" : "Idle", useTransitions); | ||
VisualStateManager.GoToState(this, IsContentVisible ? "Visible" : "Hidden", useTransitions); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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,26 @@ | ||
using System; | ||
|
||
namespace MapEditor.Controls | ||
{ | ||
public class ErrorEventArgs : EventArgs | ||
{ | ||
protected Exception m_ErrorException; | ||
|
||
public Exception ErrorException | ||
{ | ||
get | ||
{ | ||
return m_ErrorException; | ||
} | ||
protected set | ||
{ | ||
m_ErrorException = value; | ||
} | ||
} | ||
|
||
public ErrorEventArgs(Exception errorExcetion) : base() | ||
{ | ||
m_ErrorException = errorExcetion; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.