private void LoadUnparsed_Click(object sender, EventArgs e) { ChatLog = Main.ParseChatLog(Properties.Settings.Default.FolderPath, false, showError: true); loadedFrom = ChatLog == string.Empty ? LoadedFrom.None : LoadedFrom.Unparsed; if (chatLogLoaded) { if (GetWordsToFilterIn().Count > 0) { TryToFilter(fastFilter: true); } else { string chatLog = previousLog = ChatLog; if (RemoveTimestamps.Checked) { chatLog = Regex.Replace(chatLog, @"\[\d{1,2}:\d{1,2}:\d{1,2}\] ", string.Empty); } Filtered.Text = chatLog; } } }
void IPicasso <Bitmap, Drawable> .Complete(IBitmapHunter <Bitmap, Drawable> hunter) { Uri uri = hunter.Data.Uri; Action <Bitmap, Drawable> action = hunter.Action; List <Action <Bitmap, Drawable> > additionalActions = hunter.Actions; Bitmap result = hunter.Result; LoadedFrom loadedFrom = hunter.LoadedFrom; Exception exception = hunter.Exception; if (action != null) { CompleteAction(result, action, loadedFrom); } if (additionalActions != null) { foreach (Action <Bitmap, Drawable> additionalAction in additionalActions) { CompleteAction(result, additionalAction, loadedFrom); } } if (m_Listener != null && exception != null) { m_Listener.OnImageLoadFailed(this, uri, exception); } }
public void Display(Bitmap bitmap, IImageAware imageAware, LoadedFrom loadedFrom) { if (!(imageAware is ImageViewAware)) { throw new ArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); } Bitmap roundedBitmap = RoundCorners(bitmap, (ImageViewAware)imageAware, roundPixels); imageAware.SetImageBitmap(roundedBitmap); }
public void Complete(TBitmap bitmap, LoadedFrom loadedFrom) { OnComplete(bitmap, loadedFrom); if (m_OnSuccessListener != null) { m_OnSuccessListener(); } Finish(); }
protected override void OnComplete(TBitmap bitmap, LoadedFrom loadedFrom) { if (bitmap == null) { throw new Exception(String.Format("Attempted to complete action with no result!\n{0}", this)); } var target = this.Target as ITarget <TBitmap, TPlaceholder, TError>; if (target != null) { target.OnImageLoaded(bitmap, Picasso, loadedFrom); } }
protected override void OnComplete(UIImage bitmap, LoadedFrom loadedFrom) { if (bitmap == null) { throw new Exception(String.Format("Attempted to complete action with no result!\n{0}", this)); } var target = this.Target as UIImageView; if (target == null) { return; } target.Image = bitmap; }
protected override void OnComplete(Bitmap bitmap, LoadedFrom loadedFrom) { if (bitmap == null) { throw new Exception(String.Format("Attempted to complete action with no result!\n{0}", this)); } var target = this.Target as ImageView; if (target == null || target.Handle == IntPtr.Zero) { return; } PicassoDrawable.SetBitmap(target, m_Picasso.Context, bitmap, loadedFrom, FadeMode); }
private void BrowseForParsed_Click(object sender, EventArgs e) { try { ChatLog = Filtered.Text = string.Empty; OpenFileDialog.InitialDirectory = string.IsNullOrWhiteSpace(Properties.Settings.Default.BackupPath) ? Path.GetPathRoot(Environment.SystemDirectory) : Properties.Settings.Default.BackupPath; OpenFileDialog.Filter = "Text File | *.txt"; DialogResult result = OpenFileDialog.ShowDialog(); if (result == DialogResult.OK) { using (StreamReader sr = new StreamReader(OpenFileDialog.FileName)) { ChatLog = sr.ReadToEnd(); } } loadedFrom = ChatLog == string.Empty ? LoadedFrom.None : LoadedFrom.Parsed; if (chatLogLoaded) { if (GetWordsToFilterIn().Count > 0) { TryToFilter(fastFilter: true); } else { string chatLog = previousLog = ChatLog; if (RemoveTimestamps.Checked) { chatLog = Regex.Replace(chatLog, @"\[\d{1,2}:\d{1,2}:\d{1,2}\] ", string.Empty); } Filtered.Text = chatLog; } } } catch { ChatLog = Filtered.Text = string.Empty; MessageBox.Show("An error occured while reading the selected file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CompleteAction(Bitmap result, Action <Bitmap, Drawable> action, LoadedFrom loadedFrom) { if (action.Cancelled) { return; } m_TargetToAction.Remove(action.Target); if (result != null) { action.Complete(result, loadedFrom); } else { action.Error(); } }
void IPicasso <UIImage, UIImage> .Complete(IBitmapHunter <UIImage, UIImage> hunter) { Action <UIImage, UIImage> action = hunter.Action; List <Action <UIImage, UIImage> > actions = hunter.Actions; UIImage result = hunter.Result; LoadedFrom loadedFrom = hunter.LoadedFrom; if (action != null) { CompleteAction(result, action, loadedFrom); } if (actions != null) { foreach (Action <UIImage, UIImage> action_ in actions) { CompleteAction(result, action_, loadedFrom); } } }
public void Display(Bitmap bitmap, IImageAware imageAware, LoadedFrom loadedFrom) { if (!(imageAware is ImageViewAware)) { throw new ArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); } Bitmap roundedBitmap = RoundCorners(bitmap, (ImageViewAware)imageAware, roundPixels); imageAware.SetImageBitmap(roundedBitmap); }
public override void Display(Bitmap bitmap, IImageAware imageAware, LoadedFrom p2) { base.Display(bitmap, imageAware, p2); imageAware.SetImageDrawable(new CircleDrawable(bitmap, margin)); }
public void OnImageLoaded(UIImage image, IPicasso <UIImage, UIImage> picasso, LoadedFrom loadedFrom) { ResetBackgroundColor(); RemoveSpinner(); m_ImageView.Image = image; }
public Result(TBitmap bitmap, LoadedFrom loadedFrom, int exifOrientation) { m_Bitmap = bitmap; m_LoadedFrom = loadedFrom; m_ExifOrientation = exifOrientation; }
public Result(TBitmap bitmap, LoadedFrom loadedFrom) : this(bitmap, loadedFrom, 0) { }
protected abstract void OnComplete(TBitmap bitmap, LoadedFrom loadedFrom);
private void CompleteAction(UIImage result, Action <UIImage, UIImage> action, LoadedFrom loadedFrom) { if (action.Cancelled) { return; } m_TargetToAction.Remove(action.Target); if (result != null) { action.Complete(result, loadedFrom); } else { action.Error(); } }
internal static void SetBitmap(ImageView target, Context context, Bitmap bitmap, LoadedFrom loadedFrom, FadeMode fadeMode) { Drawable placeholder = target.Drawable; var drawable = new PicassoDrawable(context, bitmap, placeholder, loadedFrom, fadeMode); target.SetImageDrawable(drawable); }
protected override void OnComplete(TBitmap bitmap, LoadedFrom loadedFrom) { }
private PicassoDrawable(Context context, Bitmap bitmap, Drawable placeholder, LoadedFrom loadedFrom, FadeMode fadeMode) : base(context.Resources, bitmap) { bool fade = fadeMode == FadeMode.Always || (loadedFrom != LoadedFrom.Memory && fadeMode == FadeMode.NotFromMemory); if (fade) { m_Placeholder = placeholder; m_Animating = true; m_StartTimeMillis = SystemClock.UptimeMillis(); } }