Exemplo n.º 1
0
        public FlowImage Next()
        {
            if (source == null)
            {
                throw new ArgumentNullException("Source");
            }

            FlowImage ret = null;

            int del = selectPrevIndex(selectPrevIndex(selectPrevIndex(Index)));

            if (DB.Count > del)
            {
                DB[del].Deletable();
            }
            int next = Index = selectNextIndex(Index);

            if (DB.Count > next)
            {
                ret = DB[next];
                for (int i = 1; i <= 5; i++)
                {
                    next = selectNextIndex(next + 1);
                    DB[next].Prepare();
                }
            }
            return(ret);
        }
Exemplo n.º 2
0
        public FlowImage Previous()
        {
            if (source == null)
            {
                throw new ArgumentNullException("Source");
            }

            int       prev = Index = selectPrevIndex(Index);
            FlowImage ret  = DB[prev];

            return(ret);
        }
Exemplo n.º 3
0
        internal void GoToID(string id)
        {
            if (string.Empty.CompareTo(id) == 0)
            {
                Index = 0;
            }
            else
            {
                int       searchindex = 0;
                int       a = 0, b = 1;
                FlowImage c = null;

                int.TryParse(id, out a);
                bool found = false;
                lock (dbLoadLock)
                {
                    do
                    {
                        loadImgDB();
                        for (; searchindex < DbCount; searchindex++)
                        {
                            FlowImage k = DB[searchindex];
                            if (k.ID.CompareTo(id) == 0)
                            {
                                found = true;
                                break;
                            }
                            else
                            {
                                if (c == null || c.IdInt < k.IdInt)
                                {
                                    c = k;
                                }
                            }
                        }
                    } while (!found && DbCount < DbMaxCount);
                }
                if (found)
                {
                    Index = searchindex - 1;
                }
                else
                {
                    Index = b - 1;
                }
            }
        }
Exemplo n.º 4
0
        private void view(FlowImage fi)
        {
            string
                id             = "none"
            , lnk              = "http://sklampt.de"
            , rat              = "Other";
            List <string> tags = new List <string>();

            System.Drawing.Image img = new Bitmap(1, 1);
            bool downloaded          = false;

            if (fi != null)
            {
                id = fi.ID;
                if (fi.Lnk == null)
                {
                    lnk = "";
                }
                else
                {
                    lnk = fi.Lnk.ToString();
                }
                rat = String.Format("{0}",
                                    Enum.GetName(typeof(STK.ImageFlowClient.FlowImage.rating), fi.Rating));
                tags       = fi.Tags;
                img        = fi.Image;
                downloaded = fi.IsDownloaded;
            }
            MemoryStream ms = new MemoryStream();

            img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            var s = new BitmapImage();

            s.BeginInit();
            s.StreamSource = ms;
            s.CacheOption  = BitmapCacheOption.OnLoad;
            s.EndInit();
            s.Freeze();

            Dispatcher.Invoke(new Action(() =>
            {
                tmp                   = fi;
                imgInfo.Header        = String.Format("Info Box - {0}", id);
                imgInfoLnkLbl.Content = lnk;
                imgInfoRating.Content = rat;

                imgInfoTags.Items.Clear();
                foreach (string tag in tags)
                {
                    Label l             = new Label();
                    l.Content           = tag;
                    l.MouseDoubleClick += (object sender, MouseButtonEventArgs e) =>
                    {
                        addTag((string)(sender as Label).Content);
                    };
                    imgInfoTags.Items.Add(l);
                }


                imgView.Source = s;

                optGoToID.Text = String.Format("{0}", id);

                isDownloaded.IsChecked = downloaded;

                statisticsDB.Content = String.Format(
                    "{0,7} / {1,7} / {2,7}"
                    , flow.Index + 1
                    , flow.DbCount
                    , flow.DbMaxCount
                    );
            }));
        }