示例#1
0
        public string KeyValueToString(string key, int indentLevel, PrintStyle style)
        {
            string             output = "";
            IPBXProjExpression value;

            if (!TryGetValue(key, out value))
            {
                return(output);
            }

            string preComment = GetPreCommentForKey(key);

            if (!string.IsNullOrEmpty(preComment))
            {
                output += "\n" + preComment + "\n";
            }

            string tabs = "";

            for (int ii = 0; ii < indentLevel; ++ii)
            {
                tabs += "\t";
            }

            output += tabs + key;
            string keyComment = GetCommentForKey(key);

            if (!string.IsNullOrEmpty(keyComment))
            {
                output += " " + keyComment;
            }

            output += " = ";

            switch (style)
            {
            case PrintStyle.Indented:
                output += IndentedEntry(value, indentLevel);
                break;

            case PrintStyle.Inline:
            default:
                output += InlineEntry(value);
                break;
            }

            output += ";\n";
            string postComment = GetPostCommentForKey(key);

            if (!string.IsNullOrEmpty(postComment))
            {
                output += postComment + "\n";
            }

            return(output);
        }
示例#2
0
 /// <summary>
 /// Is this PrintheadType compatible with the argument PrintStyle?
 /// </summary>
 /// <param name="printStyle"></param>
 /// <returns></returns>
 public bool IsPrintStylePossible(PrintStyle printStyle)
 {
     foreach (PrintStyle possiblePrintStyle in _possiblePrintStylesList)
     {
         if (possiblePrintStyle == printStyle)
         {
             return(true);
         }
     }
     return(false);
 }
示例#3
0
        public void GetPrintStyle()
        {
            PrintStyle ps = ConvertUtil.GetPrintStyle("1", "1");

            Assert.IsTrue(ps.IsBrifeStyle);
            Assert.IsTrue(ps.IsPrintInLast);

            ps = ConvertUtil.GetPrintStyle("", "");
            Assert.False(ps.IsBrifeStyle);
            Assert.False(ps.IsPrintInLast);

            ps = ConvertUtil.GetPrintStyle("0", "0");
            Assert.False(ps.IsBrifeStyle);
            Assert.False(ps.IsPrintInLast);
        }
示例#4
0
        // השיטה הנכונה
        static void PrintArray(int[] arr, PrintStyle printStyle)
        {
            for (int i = 0; i < arr.Length; i++)
            {
                switch (printStyle)
                {
                case PrintStyle.Space: Console.Write(arr[i] + " "); break;

                case PrintStyle.Tab: Console.Write(arr[i] + "\t"); break;

                case PrintStyle.Enter: Console.WriteLine(arr[i]); break;
                }
            }

            Console.WriteLine();
        }
示例#5
0
        /// <summary>
        /// Thread safe printing call.
        /// </summary>
        /// <param name="Message">The message to print</param>
        /// <param name="Style">The style enum to indicate how to print</param>
        /// <param name="SuppressCrLf">If true, the string will be printed without a trailing cr+lf</param>
        private void PrintOutput(string Message, PrintStyle Style = PrintStyle.Normal, bool SuppressCrLf = false)
        {
            if (Output.InvokeRequired)
            {
                Output.Invoke(new Printer(PrintOutput), new object[] { Message, Style, SuppressCrLf });
            }
            else
            {
                Color color;

                switch (Style)
                {
                case PrintStyle.Instruction:
                    color = Color.Black;
                    break;

                case PrintStyle.GalilData:
                    color = Color.Green;
                    break;

                case PrintStyle.Normal:
                    color = Color.Blue;
                    break;

                case PrintStyle.Err:
                    color = Color.Red;
                    break;

                case PrintStyle.GclibData:
                    color = Color.Magenta;
                    break;

                default:
                    color = Color.Blue;
                    break;
                }//switch

                Output.SelectionStart = Output.Text.Length;
                Output.SelectionColor = color;
                Output.AppendText(Message);

                if (!SuppressCrLf)
                {
                    Output.AppendText("\r\n");
                }
            }//invoke check
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PrintOptionsForm"/> form.
 /// </summary>
 /// <param name="info">The <see cref="PrintInfo"/> object.</param>
 /// <param name="defaultStyle">The <see cref="PrintStyle"/> object which should be selected initially.</param>
 /// <param name="printContext">The <see cref="PrintContextType"/> value, determining the filter of styles which should be shown in a form.</param>
 public PrintOptionsDialog(PrintInfo info, PrintStyle defaultStyle, PrintContextType printContext)
 {
     InitializeComponent();
     _context = printContext;
     _info = info;
     foreach (PrintStyle ps in _info.PrintStyles)
     {
         if ((_context & ps.Context) != 0)
         {
             lstStyles.Items.Add(ps);
         }
     }
     if (defaultStyle != null && lstStyles.Items.Count > 0)
     {
         lstStyles.SelectedItem = defaultStyle;
     }
     _hidePrivateAppointmentsInitial = HidePrivateAppointments = _info.HidePrivateAppointments;
 }
示例#7
0
 public PendingMessage(object message, PrintStyle printStyle, Object sender)
 {
     this.printStyle = printStyle;
     this.message    = message;
     this.sender     = sender;
 }
示例#8
0
 public PendingMessage(object message, PrintStyle printStyle)
 {
     this.printStyle = printStyle;
     this.message    = message;
     sender          = null;
 }
示例#9
0
 public byte[] SetPrintStyle(PrintStyle style)
 {
     return(new[] { AsciiTable.ESC, AsciiTable.EXCLAMATION_MARK, (byte)style });
 }
示例#10
0
 /// <summary>
 /// Sends the specified printing style to the printer.
 /// </summary>
 /// <param name="style">The <see cref="PrintStyle"/> object to print.</param>
 public void Print(PrintStyle style)
 {
     Print(style, _schedule.VisibleDates[0], _schedule.VisibleDates[_schedule.VisibleDates.Count - 1]);
 }
示例#11
0
 /// <summary>
 /// 设置打印样式
 /// </summary>
 /// <param name="style">打印样式</param>
 public byte[] Styles(PrintStyle style) => new[] { ASCIIControlConst.ESC, CommandConst.Chars.StyleMode, style.ToByte() };
示例#12
0
 /// <summary>
 /// Sends the specified printing style to the printer.
 /// </summary>
 /// <param name="style">The <see cref="PrintStyle"/> object to print.</param>
 /// <param name="start">The <see cref="DateTime"/> value specifying the beginning of the print range.</param>
 /// <param name="end">The <see cref="DateTime"/> value specifying the end of the print range.</param>
 public void Print(PrintStyle style, DateTime start, DateTime end)
 {
     if (style != null)
     {
         SetupPrintContext(style, start, end);
         InternalPrint();
     }
 }
示例#13
0
 /// <summary>
 /// Opens a separate application window in which end users can preview 
 /// the output that would be generated by the print operation.
 /// </summary>
 /// <param name="style">The <see cref="PrintStyle"/> object to preview.</param>
 /// <param name="start">The <see cref="DateTime"/> value specifying the beginning of the print range.</param>
 /// <param name="end">The <see cref="DateTime"/> value specifying the end of the print range.</param>
 public void Preview(PrintStyle style, DateTime start, DateTime end)
 {
     if (style != null)
     {
         SetupPrintContext(style, start, end);
         PreviewCurrentStyle();
     }
 }
 /* Character Commands */
 public virtual byte[] SetStyles(PrintStyle style) => new byte[]
 {
     Cmd.ESC, Chars.StyleMode, (byte)style
 };
示例#15
0
 /// <summary>
 /// 设置打印样式
 /// </summary>
 /// <param name="style">打印样式</param>
 public TPrinter Styles(PrintStyle style) => Write(Command.Style.Styles(style));
示例#16
0
 /* Character Commands */
 public byte[] SetStyles(PrintStyle style)
 {
     return(new[] { Cmd.ESC, Chars.StyleMode, (byte)style });
 }
示例#17
0
 // load specified PrintStyle into the PrintDocument control and initialize date range
 internal void SetupPrintContext(PrintStyle style, DateTime start, DateTime end)
 {
     LoadStyle(style);
     style.SetDateRangeTags(PrintDocument, start, end);
 }
示例#18
0
 public DirectPrinter SetStyles(PrintStyle style)
 {
     UpdateBuffer(this.Emitter.SetStyles(style));
     return(this);
 }
 public void printTextBox1(string a, PrintStyle printStyle = PrintStyle.Normal)
 {
     PrintOutput(textBox1, a, printStyle, true);
 }
示例#20
0
        public static void Print(this Tree tree, PrintStyle printStyle) // дерево может не вместиться в консоль, тогда будет ошибка
        {
            if (tree.Root == null)
            {
                Console.WriteLine("tree is empty");
                return;
            }

            var nodes = new Queue <TreeNode>();

            nodes.Enqueue(tree.Root);
            List <List <TreeNode> > levels = new List <List <TreeNode> >();
            int height = 0;
            int width  = 1;

            while (true)
            {
                var isEnd = true;
                levels.Add(new List <TreeNode>());

                for (int i = 0; i < width; i++)
                {
                    var current = nodes.Dequeue();

                    if (current == null)
                    {
                        nodes.Enqueue(null);
                        nodes.Enqueue(null);
                        levels[height].Add(null);
                        continue;
                    }
                    else
                    {
                        levels[height].Add(current);

                        if (current.Left != null)
                        {
                            nodes.Enqueue(current.Left);
                            isEnd = false;
                        }
                        else
                        {
                            nodes.Enqueue(null);
                        }

                        if (current.Right != null)
                        {
                            nodes.Enqueue(current.Right);
                            isEnd = false;
                        }
                        else
                        {
                            nodes.Enqueue(null);
                        }
                    }
                }
                width *= 2;
                height++;
                if (isEnd)
                {
                    break;
                }
            }

            //Console.Clear();

            if (printStyle == PrintStyle.Horisontal)
            {
                PrintHorisontal(tree, height, levels);
            }
            else if (printStyle == PrintStyle.Vertical)
            {
                PrintVertical(tree, height, levels);
            }
            else if (printStyle == PrintStyle.Simple)
            {
                PrintSimple(tree, height, levels);
            }
            else if (height < 5)
            {
                PrintHorisontal(tree, height, levels);
            }
            else if (height < 8)
            {
                PrintVertical(tree, height, levels);
            }
            else
            {
                PrintSimple(tree, height, levels);
            }
        }
示例#21
0
 /// <summary>
 /// Loads style definition to C1PrintDocument control.
 /// </summary>
 /// <param name="style">The <see cref="PrintStyle"/> for loading into print document object.</param>
 public void LoadStyle(PrintStyle style)
 {
     if (style.Load(PrintDocument))
     {
         CurrentStyle = style;
         AddScheduleReferences();
     }
 }