Last active
November 9, 2017 21:48
-
-
Save sailro/3ac44787050b66160bcd50cc328be1b4 to your computer and use it in GitHub Desktop.
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
var referencePoint = (ISourceLocation) InsertionPoints.SelectedItem; | |
var context = _languageService.CurrentContext; | |
var scope = UnityPackage.Settings.UnityMessageScope.ToScope(); | |
var generateComment = GenerateComment.IsChecked.HasValue && GenerateComment.IsChecked.Value; | |
UnityPackage.DTE.UnderUndoContext("MonoBehaviour Wizard", () => | |
{ | |
foreach (CheckedMethodInfoItem node in MonoBehaviourTree.Items) | |
{ | |
if (!node.IsChecked.HasValue || !node.IsChecked.Value) | |
continue; | |
// Refresh insertionPoint to get up-to-date codemodel and line numbers | |
var insertionPoint = context.GetInsertionPoints().FirstOrDefault(p => p.Caption == referencePoint.Caption); | |
if (insertionPoint == null) | |
continue; | |
var method = node.Method; | |
var comment = generateComment ? UnityMessageHelper.GetHelp(method) : string.Empty; | |
context.InsertMethod(method, insertionPoint, comment, scope); | |
} | |
}); |
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
throttledTextBoxChanges = Observable | |
.FromEventPattern<TextChangedEventArgs>(TextBox, "TextChanged") | |
.Select(e => ((TextBox) e.Sender).Text.Trim()) | |
.Throttle(TimeSpan.FromMilliseconds(200)) | |
.DistinctUntilChanged() | |
.ObserveOn(SynchronizationContext.Current) | |
.Subscribe(ApplyFilter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment