Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 4
0
        public void Complete(TBitmap bitmap, LoadedFrom loadedFrom)
        {
            OnComplete(bitmap, loadedFrom);

            if (m_OnSuccessListener != null)
            {
                m_OnSuccessListener();
            }

            Finish();
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
        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();
            }
        }
Exemplo n.º 10
0
        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);
 }
Exemplo n.º 12
0
 public override void Display(Bitmap bitmap, IImageAware imageAware, LoadedFrom p2)
 {
     base.Display(bitmap, imageAware, p2);
     imageAware.SetImageDrawable(new CircleDrawable(bitmap, margin));
 }
Exemplo n.º 13
0
 public void OnImageLoaded(UIImage image, IPicasso <UIImage, UIImage> picasso, LoadedFrom loadedFrom)
 {
     ResetBackgroundColor();
     RemoveSpinner();
     m_ImageView.Image = image;
 }
Exemplo n.º 14
0
 public Result(TBitmap bitmap, LoadedFrom loadedFrom, int exifOrientation)
 {
     m_Bitmap          = bitmap;
     m_LoadedFrom      = loadedFrom;
     m_ExifOrientation = exifOrientation;
 }
Exemplo n.º 15
0
 public Result(TBitmap bitmap, LoadedFrom loadedFrom) : this(bitmap, loadedFrom, 0)
 {
 }
Exemplo n.º 16
0
 protected abstract void OnComplete(TBitmap bitmap, LoadedFrom loadedFrom);
Exemplo n.º 17
0
        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();
            }
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
 protected override void OnComplete(TBitmap bitmap, LoadedFrom loadedFrom)
 {
 }
Exemplo n.º 20
0
        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();
            }
        }