示例#1
0
        public void ShowOrderOut(Order order, ShowWay showWay, int n = 0)
        {
            switch (showWay)
            {
            case ShowWay.Add:
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("----------\nYou add the Order:\n");
                Console.Write(order);
                break;

            case ShowWay.Delete:
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.Write("\nYou delete the order:");
                Console.Write(order);
                break;

            case ShowWay.Modify:
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.Write("----------\nThe Original order:");
                Console.Write(order);
                break;

            case ShowWay.Modified:
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.Write("----------\nThe Modified order:");
                Console.Write(order);
                break;

            case ShowWay.Search:
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.Write("----------\nThe Search result:");
                Console.Write(order);
                break;

            case ShowWay.Normal:
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                if (n != 0)
                {
                    Console.Write("\nOrder " + n + ":\n");      //循环输出
                }
                Console.Write(order);
                break;

            default: throw new Exception("Invalid Show Input.\n");
            }
        }
示例#2
0
        /// <summary>
        /// 显示提示窗口
        /// </summary>
        /// <param name="paramsList">
        /// params[0]:内容
        /// params[1]:标题
        /// params[2]:显示方式
        /// params[3]:宽度
        /// params[4]:高度
        /// params[5]:出现时间
        /// params[6]:停留时间
        /// params[7]:消失时间
        /// </param>
        public void Show(params object[] paramsList)
        {
            if (paramsList == null || paramsList.Length == 0)
            {
                return;
            }
            string afContent = paramsList[0] != null ? paramsList[0].ToString() : "";
            string afTitle   = (paramsList.Length > 1 && paramsList[1] != null) ? paramsList[1].ToString().Length < 20 ?
                               paramsList[1].ToString() : paramsList[1].ToString().Substring(0, 20) + "..." : "";
            ShowWay afShowWay = (paramsList.Length > 2 && paramsList[2] != null && paramsList[2] is ShowWay) ? (ShowWay)paramsList[2] : ShowWay.UpDown;
            int     afWidth = 0, afHeigth = 0;
            int     afshowInTime = 200, afshowTime = 3000, afshowOutTime = 500;

            if (paramsList.Length > 3 && paramsList[3] != null)
            {
                int.TryParse(paramsList[3].ToString(), out afWidth);
            }
            else
            {
                afWidth = Width;
            }
            if (paramsList.Length > 4 && paramsList[4] != null)
            {
                int.TryParse(paramsList[4].ToString(), out afHeigth);
            }
            else
            {
                afHeigth = Height;
            }
            if (paramsList.Length > 5 && paramsList[5] != null)
            {
                int.TryParse(paramsList[5].ToString(), out afshowInTime);
            }
            else
            {
                afshowInTime = _showInTime;
            }
            if (paramsList.Length > 6 && paramsList[6] != null)
            {
                int.TryParse(paramsList[6].ToString(), out afshowTime);
            }
            else
            {
                afshowTime = _showTime;
            }
            if (paramsList.Length > 7 && paramsList[7] != null)
            {
                int.TryParse(paramsList[7].ToString(), out afshowOutTime);
            }
            else
            {
                afshowTime = _showOutTime;
            }

            afWidth       = afWidth > 0 ? afWidth : Width;
            afHeigth      = afHeigth > 0 ? afHeigth : Height;
            afshowInTime  = afshowInTime > 0 ? afshowInTime : _showInTime;
            afshowTime    = afshowTime > 0 ? afshowTime : _showTime;
            afshowOutTime = afshowOutTime > 0 ? afshowOutTime : _showOutTime;

            Show(afContent, afTitle, afShowWay, afWidth, afHeigth, afshowInTime, afshowTime, afshowOutTime);
        }
示例#3
0
        protected void Show(string content, string title, ShowWay showWay, int width, int height, int showInTime, int showTime, int showOutTime)
        {
            _timerRunCount = 0;
            ShowInTaskbar  = false;
            StartPosition  = FormStartPosition.Manual;
            if (content != null)
            {
                labContent.Text = content;                 //提示的内容
            }
            //标题
            if (title != null)
            {
                Text = title.Length < 20 ? title : title.Substring(0, 20) + "...";
            }

            Width        = width;
            Height       = height;
            _showInTime  = showInTime;
            _showTime    = showTime;
            _showOutTime = showOutTime;
            _showWay     = showWay;

            _showYPoint = Screen.PrimaryScreen.WorkingArea.Height - Height;
            _showXPoint = Screen.PrimaryScreen.WorkingArea.Width - Width;
            int nowYPoint = Screen.PrimaryScreen.WorkingArea.Height;

            int sleepTime = _showInTime / 10;//每次变化的时间

            switch (showWay)
            {
            case ShowWay.Fade:
            {
                #region 窗口淡入
                Location = new Point(_showXPoint, _showYPoint);
                Opacity  = 0;
                base.Show();
                double changeOpcation = 0;
                while (_start)
                {
                    changeOpcation += 0.1;
                    if (changeOpcation >= 1)
                    {
                        changeOpcation = 1;
                        _start         = false;
                    }
                    Opacity = changeOpcation;
                    Refresh();
                    Thread.Sleep(sleepTime);
                }
                #endregion
                break;
            }

            case ShowWay.UpDown:
                //default:
            {
                #region 窗口上升
                Location = new Point(_showXPoint, nowYPoint);
                base.Show();
                int reduceHeight = Height / 10;        //每次移动的高度
                while (_start)
                {
                    nowYPoint -= reduceHeight;
                    if (nowYPoint <= _showYPoint)
                    {
                        nowYPoint = _showYPoint;
                        _start    = false;
                    }
                    Location = new Point(_showXPoint, nowYPoint);
                    Refresh();
                    Thread.Sleep(sleepTime);
                }
                #endregion
                break;
            }
            }
            if (content != null)
            {
                labContent.Text = content;                 //提示的内容
            }
            //标题
            if (title != null)
            {
                Text = title.Length < 20 ? title : title.Substring(0, 20) + "...";
            }

            _timer.Enabled    = true;
            _timer.Interval   = 100;
            _timer.Tick      += TimerTick;
            _maxTimerRunCount = _showTime / _timer.Interval;
            _timer.Start();
        }