Esempio n. 1
0
 void drawOutline(PillMode mode)
 {
     c1++;
     tb.Visibility = Visibility.Visible;
     tb.Opacity    = 1;
     if (mode == PillMode.Big || mode == PillMode.BigFirst)
     {
         tb.border.Opacity = 1;
         tb.kH             = FONT_BIG;
         tb.kW             = FONT_BIG;
         if (mode == PillMode.BigFirst)
         {
             foreColor = Colors.White;
         }
         else
         {
             foreColor = COLOR_BIG;
         }
         borderColor = Colors.White;
     }
     else
     {
         tb.kH             = FONT_SMALL;
         tb.kW             = FONT_SMALL;
         tb.border.Opacity = 0.8;
         if (mode == PillMode.Old)
         {
             foreColor = Colors.LightGray;
         }
         else
         {
             if (mode == PillMode.First)
             {
                 foreColor = Colors.White;
             }
             else
             {
                 foreColor = fTskColor;
             }
         }
         borderColor = foreColor;
     }
 }
Esempio n. 2
0
        void pillMode(PillMode mode, bool LayoutUpdated = false)
        {
            if ((!LayoutUpdated)&&(mode == fMode)) return;
            fMode = mode;
            if (mode == PillMode.Hide)
            {
                Opacity = 0;
                return;
            }
            Opacity = 1;
            TBitmapHolder holder;
            char key=tb.text[0];
            Dictionary<PillMode, TBitmapHolder> cachedTm;
            if (!cachedTb.TryGetValue(key, out cachedTm))
            {
                cachedTm = new Dictionary<PillMode, TBitmapHolder>();
                cachedTb.Add(key, cachedTm);
            }
            if (!cachedTm.TryGetValue(mode, out holder))
            {
                holder = new TBitmapHolder();
                cachedTm.Add(mode, holder);
            }

            if(tb.Visibility==Visibility.Collapsed){
                if (holder.state == TBitmapHolderState.Updating)
                {
                    holder.onReady += new EventHandler(OnHolderReady);
                }else
                if((holder.state==TBitmapHolderState.Clean)||(holder.bitmap.PixelWidth < ActualWidth)){
                    holder.state = TBitmapHolderState.Updating;
                    drawOutline(mode);
                }else{
                    c2++;
                    img.Source = holder.bitmap;
                }
            }else{
                if(LayoutUpdated){
                    holder.bitmap = new WriteableBitmap((int)ActualWidth, (int)ActualHeight);
                    holder.bitmap.Render(tb, null);
                    holder.bitmap.Invalidate();
                    holder.state = TBitmapHolderState.Ready;
                    if(holder.onReady!=null)
                        holder.onReady.Invoke(null, null);
                    holder.onReady = null;
                    tb.Visibility = Visibility.Collapsed;
                    img.Source = holder.bitmap;
                }
            }
            #if DEBUG
            System.Diagnostics.Debugger.Log(0, "", c1.ToString() + "/" + c2.ToString() + "\n");
            #endif
        }
Esempio n. 3
0
 void drawOutline(PillMode mode)
 {
     c1++;
     tb.Visibility = Visibility.Visible;
     tb.Opacity = 1;
     if (mode == PillMode.Big || mode == PillMode.BigFirst)
     {
         tb.border.Opacity = 1;
         tb.kH = FONT_BIG;
         tb.kW = FONT_BIG;
         if (mode == PillMode.BigFirst)
             foreColor = Colors.White;
         else
             foreColor = COLOR_BIG;
         borderColor = Colors.White;
     }
     else
     {
         tb.kH = FONT_SMALL;
         tb.kW = FONT_SMALL;
         tb.border.Opacity = 0.8;
         if (mode == PillMode.Old)
         {
             foreColor = Colors.LightGray;
         }
         else
         {
             if (mode == PillMode.First) foreColor = Colors.White;
             else foreColor = fTskColor;
         }
         borderColor = foreColor;
     }
 }
Esempio n. 4
0
        void pillMode(PillMode mode, bool LayoutUpdated = false)
        {
            if ((!LayoutUpdated) && (mode == fMode))
            {
                return;
            }
            fMode = mode;
            if (mode == PillMode.Hide)
            {
                Opacity = 0;
                return;
            }
            Opacity = 1;
            TBitmapHolder holder;
            char          key = tb.text[0];
            Dictionary <PillMode, TBitmapHolder> cachedTm;

            if (!cachedTb.TryGetValue(key, out cachedTm))
            {
                cachedTm = new Dictionary <PillMode, TBitmapHolder>();
                cachedTb.Add(key, cachedTm);
            }
            if (!cachedTm.TryGetValue(mode, out holder))
            {
                holder = new TBitmapHolder();
                cachedTm.Add(mode, holder);
            }

            if (tb.Visibility == Visibility.Collapsed)
            {
                if (holder.state == TBitmapHolderState.Updating)
                {
                    holder.onReady += new EventHandler(OnHolderReady);
                }
                else
                if ((holder.state == TBitmapHolderState.Clean) || (holder.bitmap.PixelWidth < ActualWidth))
                {
                    holder.state = TBitmapHolderState.Updating;
                    drawOutline(mode);
                }
                else
                {
                    c2++;
                    img.Source = holder.bitmap;
                }
            }
            else
            {
                if (LayoutUpdated)
                {
                    holder.bitmap = new WriteableBitmap((int)ActualWidth, (int)ActualHeight);
                    holder.bitmap.Render(tb, null);
                    holder.bitmap.Invalidate();
                    holder.state = TBitmapHolderState.Ready;
                    if (holder.onReady != null)
                    {
                        holder.onReady.Invoke(null, null);
                    }
                    holder.onReady = null;
                    tb.Visibility  = Visibility.Collapsed;
                    img.Source     = holder.bitmap;
                }
            }
#if DEBUG
            System.Diagnostics.Debugger.Log(0, "", c1.ToString() + "/" + c2.ToString() + "\n");
#endif
        }