-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish implementing new dialog approach
- Loading branch information
1 parent
742d754
commit 0780d98
Showing
22 changed files
with
300 additions
and
125 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Media; | ||
|
||
namespace OfficeRibbonXEditor.Controls | ||
{ | ||
public class DialogControl : UserControl | ||
{ | ||
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( | ||
nameof(Title), | ||
typeof(string), | ||
typeof(DialogControl)); | ||
|
||
public string Title | ||
{ | ||
get => (string) this.GetValue(TitleProperty); | ||
set => this.SetValue(TitleProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty IconProperty = DependencyProperty.Register( | ||
nameof(Icon), | ||
typeof(ImageSource), | ||
typeof(DialogControl)); | ||
|
||
public ImageSource Icon | ||
{ | ||
get => (ImageSource) this.GetValue(IconProperty); | ||
set => this.SetValue(IconProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty PreferredWidthProperty = DependencyProperty.Register( | ||
nameof(PreferredWidth), | ||
typeof(double), | ||
typeof(DialogControl)); | ||
|
||
public double PreferredWidth | ||
{ | ||
get => (double) this.GetValue(PreferredWidthProperty); | ||
set => this.SetValue(PreferredWidthProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty PreferredHeightProperty = DependencyProperty.Register( | ||
nameof(PreferredHeight), | ||
typeof(double), | ||
typeof(DialogControl)); | ||
|
||
public double PreferredHeight | ||
{ | ||
get => (double) this.GetValue(PreferredHeightProperty); | ||
set => this.SetValue(PreferredHeightProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty SizeToContentProperty = DependencyProperty.Register( | ||
nameof(SizeToContent), | ||
typeof(SizeToContent), | ||
typeof(DialogControl), | ||
new FrameworkPropertyMetadata(SizeToContent.WidthAndHeight)); | ||
|
||
public SizeToContent SizeToContent | ||
{ | ||
get => (SizeToContent) this.GetValue(SizeToContentProperty); | ||
set => this.SetValue(SizeToContentProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty ResizeModeProperty = DependencyProperty.Register( | ||
nameof(ResizeMode), | ||
typeof(ResizeMode), | ||
typeof(DialogControl), | ||
new FrameworkPropertyMetadata(ResizeMode.NoResize)); | ||
|
||
public ResizeMode ResizeMode | ||
{ | ||
get => (ResizeMode) this.GetValue(ResizeModeProperty); | ||
set => this.SetValue(ResizeModeProperty, value); | ||
} | ||
} | ||
} |
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 was deleted.
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
This file was deleted.
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
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,46 @@ | ||
using OfficeRibbonXEditor.Interfaces; | ||
using OfficeRibbonXEditor.Models; | ||
|
||
namespace OfficeRibbonXEditor.ViewModels | ||
{ | ||
|
||
public class CallbackDialogViewModel : DialogBase, IContentDialog<string> | ||
{ | ||
private VbaLexer lexer; | ||
|
||
private string code; | ||
|
||
public VbaLexer Lexer | ||
{ | ||
get => this.lexer; | ||
set | ||
{ | ||
if (!this.Set(ref this.lexer, value) || this.Code == null) | ||
{ | ||
return; | ||
} | ||
|
||
this.Lexer.Editor.Text = this.Code; | ||
} | ||
} | ||
|
||
public string Code | ||
{ | ||
get => this.code; | ||
set | ||
{ | ||
if (!this.Set(ref this.code, value) || this.Lexer == null) | ||
{ | ||
return; | ||
} | ||
|
||
this.Lexer.Editor.Text = this.Code; | ||
} | ||
} | ||
|
||
public void OnLoaded(string payload) | ||
{ | ||
this.Code = payload; | ||
} | ||
} | ||
} |
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
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.