This file contains hidden or 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
| using System; | |
| using IronPython.Hosting; | |
| namespace ConsoleSample | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var engine = Python.CreateEngine(); |
This file contains hidden or 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
| private static Random random = new Random(); | |
| public static string RandomString(int length) | |
| { | |
| const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
| return new string(Enumerable.Repeat(chars, length) | |
| .Select(s => s[random.Next(s.Length)]).ToArray()); | |
| } |
This file contains hidden or 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
| function isIe() { | |
| var ua = navigator.userAgent; | |
| var is_ie = ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1; | |
| return is_ie; | |
| }; |
This file contains hidden or 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
| public sealed class TaskNotifyObserver<TResult> : INotifyPropertyChanged | |
| { | |
| public TaskNotifyObserver(Task<TResult> task) | |
| { | |
| Task = task; | |
| if (!task.IsCompleted) | |
| { | |
| var _ = WatchTaskAsync(task); | |
| } | |
| } |
This file contains hidden or 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
| <ControlTemplate x:Key="ValidationTemplate"> | |
| <Grid> | |
| <Border BorderBrush="#FFCB2E2E" BorderThickness="1" Background="#11FF0000" IsHitTestVisible="False" x:Name="errorBorder"/> | |
| <AdornedElementPlaceholder x:Name="placeholder" /> | |
| <Popup AllowsTransparency="True" HorizontalAlignment="Right" HorizontalOffset="0" VerticalOffset="0" PopupAnimation="Fade" Placement="Right" | |
| PlacementTarget="{Binding ElementName=errorBorder}" IsOpen="{Binding ElementName=placeholder, Path=AdornedElement.IsFocused, Mode=OneWay}"> | |
| <StackPanel Orientation="Horizontal"> | |
| <Border Background="#FFCB2E2E" CornerRadius="4" Padding="4"> | |
| <TextBlock HorizontalAlignment="Center" Foreground="White" FontWeight="Bold" Margin="2,0,0,0" | |
| Text="{Binding ErrorContent}" /> |
This file contains hidden or 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
| public class ReverseBooleanToVisibilityConverter : IValueConverter | |
| { | |
| public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |
| { | |
| var b = (bool)value; | |
| if (b) | |
| { | |
| return Visibility.Collapsed; | |
| } |
This file contains hidden or 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
| <DataGrid.RowStyle> | |
| <Style TargetType="DataGridRow"> | |
| <Style.Triggers> | |
| <DataTrigger Binding="{Binding CultureId}" Value="-1"> | |
| <Setter Property="IsEnabled" Value="False"/> | |
| </DataTrigger> | |
| <MultiDataTrigger> | |
| <MultiDataTrigger.Conditions> | |
| <Condition Binding="{Binding}" Value="{x:Static CollectionView.NewItemPlaceholder}" /> | |
| <Condition Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsSelected}" Value="False" /> |
This file contains hidden or 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
| public class BindableSelectedItemBehavior : Behavior<TreeView> | |
| { | |
| #region SelectedItem Property | |
| public object SelectedItem | |
| { | |
| get { return (object)GetValue(SelectedItemProperty); } | |
| set { SetValue(SelectedItemProperty, value); } | |
| } |