public QuoteEmojiAnalizer([NotNull] Regex regex, [NotNull] Dictionary <string, string> emojiPaths) { Asure.NotNull(regex, emojiPaths); _regex = regex; _emojiPaths = emojiPaths; }
public SelectGirlWindow([NotNull] IEnumerable <Girl> girls, [NotNull] Action <Girl> callback) { Asure.NotNull(girls, callback); _callback = callback; InitializeComponent(); var children = this.girlsPanel.Children; var tiles = girls.Select(g => { var bitmap = Api.Api.CreateImageFromPath(g.Path); // set girl as id for tile so that we know which was clicked var tile = new TitledTile(g) { Title = g.Name, TileImage = bitmap }; tile.Click += OnGirlTileClicked; return(tile); }); foreach (var tile in tiles) { children.Add(tile); } Show(); }
private void QuoteLocation_Click(object sender, RoutedEventArgs e) { var tag = (sender as MenuItem).Tag; Asure.NotNull(tag); this.quoteField.VerticalAlignment = (VerticalAlignment)tag; }
public GirlQuoteProvider([NotNull] IList <string> quotes, [NotNull] IQuoteAnalizer quoteAnalizer) { Asure.NotNull(quotes, quoteAnalizer); _quotes = quotes; _analizer = quoteAnalizer; _quoteRandomizer = new Random(); }
public void SetGirl([NotNull] Girl girl) { Asure.NotNull(girl, girl.Path, girl.Name, girl.Quotes); QuoteShown = false; BitmapImage image = Api.Api.CreateImageFromPath(girl.Path); this.girlImage.Source = image; this.girlImage.ToolTip = girl.Name; }
public void ProvideQuote([NotNull] InlineCollection inlines) { Asure.NotNull(inlines); inlines.Clear(); var quote = GetNextQuote(); _analizer.Analize(quote); _analizer.ProcessAndStyle(inlines); }
public static BitmapImage CreateImageFromPath([NotNull] string path) { Asure.NotNull(path); var bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(Path.GetFullPath(path)); bitmap.EndInit(); return(bitmap); }
public AddGirlWindow([NotNull] Action <Girl> callback) { Asure.NotNull(callback); _callback = callback; this.DataContext = this; addQuoteButton_Click(null, null); InitializeComponent(); confirmButton.IsEnabled = false; Show(); }
public void SetGirl([NotNull] Girl girl) { Asure.NotNull(girl); _mainWindow.SetGirl(girl); _mainWindow.QuoteProvider = new GirlQuoteProvider(girl.Quotes, _emojiConfig.GetQuoteAnalizer()); if (_visible == false) { _mainWindow.Show(); _visible = true; } }
public QuoteEmojiConfig() { if (_config == null) { using (var reader = new StreamReader(ConfigFileName)) { _config = Deserializer.Consume <List <Emoji> >(reader, ModelMembers.Property); Asure.NotNull(_config); } } NormalizeCodes(); BuildPathsLookup(); BuildAnalizer(); }
private void girlImage_MouseDown(object sender, MouseButtonEventArgs e) { QuoteShown = e.ChangedButton == MouseButton.Left || _quoteShown; if (e.ChangedButton == MouseButton.Left) { _quoteProvider.ProvideQuote(this.quoteField.Inlines); } else if (_quoteShown) { this.ContextMenu = this.FindResource("contextMenu") as ContextMenu; Asure.NotNull(this.ContextMenu); this.ContextMenu.PlacementTarget = sender as UIElement; this.ContextMenu.IsOpen = true; } }
public GirlsConfig() { if (!File.Exists(ConfigFileName)) { WriteDefaultConfig(); } if (!Directory.Exists(GirlsFolder)) { CreateDefaultGirl(); } if (_config == null) { using (var reader = new StreamReader(ConfigFileName)) { _config = Deserializer.Consume <Config>(reader, ModelMembers.Property); Asure.NotNull(_config); } } }