public static void Main()
        {
            IRenderer renderer = new FileRenderer();
            IInputHandler inputHandler = new ConsoleInputHandler();

            BookStoreEngine engine = new BookStoreEngine(renderer, inputHandler);

            engine.Run();
        }
Esempio n. 2
0
        internal FileDialog()
        {
#if !UNITY_STANDALONE && !UNITY_ANDROID
            throw new NotSupportedException();
#endif

            BackColor     = Color.White;
            Filter        = "All files|*.*";
            MinimumSize   = new Drawing.Size(240, 240);
            KeyPreview    = true;
            Padding       = new Padding(12, 12, 12, 12);
            SizeGripStyle = SizeGripStyle.Show;
            Text          = "File Dialog";

            handleFormSize = false;
            Size           = savedFormSize;
            handleFormSize = true;

            #region Button Back.
            buttonBack = new Button();
            buttonBack.BackgroundImageLayout = ImageLayout.Center;
            buttonBack.Enabled        = false;
            buttonBack.Font           = new Drawing.Font("Arial", 16, FontStyle.Bold);
            buttonBack.Image          = FolderNavBack;
            buttonBack.Location       = new Point(Padding.Left, uwfHeaderHeight + Padding.Top);
            buttonBack.BackColor      = Color.Transparent;
            buttonBack.uwfBorderColor = Color.Transparent;
            buttonBack.Size           = new Size(22, 22);
            if (buttonBack.Image == null)
            {
                buttonBack.Text = "◀";
            }
            buttonBack.Click += (sender, args) => ButtonBack();
            Controls.Add(buttonBack);

            ToolTip buttonBackTooltip = new ToolTip();
            buttonBackTooltip.SetToolTip(buttonBack, "Back (ALT + Left Arrow)");
            #endregion ;

            #region Button Up.
            buttonUp = new Button();
            buttonUp.BackgroundImageLayout = ImageLayout.Center;
            buttonUp.Font           = new Drawing.Font("Arial", 16, FontStyle.Bold);
            buttonUp.Image          = FolderNavUp;
            buttonUp.Location       = new Point(buttonBack.Location.X + buttonBack.Width + 8, buttonBack.Location.Y);
            buttonUp.BackColor      = Color.Transparent;
            buttonUp.uwfBorderColor = Color.Transparent;
            buttonUp.Size           = new Drawing.Size(22, 22);
            if (buttonUp.Image == null)
            {
                buttonUp.Text = "▲";
            }
            buttonUp.Click += (sender, args) => ButtonUp();
            Controls.Add(buttonUp);

            ToolTip buttonUpTooltip = new ToolTip();
            buttonUpTooltip.SetToolTip(buttonUp, "Up (ALT + Up Arrow)");
            #endregion

            #region Button Refresh.
            buttonRefresh                    = new Button();
            buttonRefresh.Anchor             = AnchorStyles.Top | AnchorStyles.Right;
            buttonRefresh.Image              = FolderNavRefresh;
            buttonRefresh.uwfImageColor      = Color.FromArgb(64, 64, 64);
            buttonRefresh.uwfImageHoverColor = buttonRefresh.uwfImageColor;
            buttonRefresh.BackColor          = Color.Transparent;
            buttonRefresh.uwfBorderColor     = Color.Transparent;
            buttonRefresh.Size               = new Size(22, 22);
            buttonRefresh.Location           = new Point(Width - Padding.Right - buttonRefresh.Width, buttonUp.Location.Y);
            buttonRefresh.Click             += (sender, args) => ButtonRefresh();
            if (buttonRefresh.Image == null)
            {
                buttonRefresh.Text = "R";
            }
            Controls.Add(buttonRefresh);

            ToolTip buttonRefreshTooltip = new ToolTip();
            buttonRefreshTooltip.SetToolTip(buttonRefresh, "Refresh (F5)");
            #endregion

            #region Textbox Path.
            textBoxPath          = new PathTextBox(this);
            textBoxPath.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            textBoxPath.Font     = new Drawing.Font("Arial", 14);
            textBoxPath.Location = new Point(buttonUp.Location.X + buttonUp.Width + 8, buttonUp.Location.Y);
            textBoxPath.Size     = new Drawing.Size(Width - textBoxPath.Location.X - Padding.Right - buttonRefresh.Width - 8, buttonBack.Height);
            Controls.Add(textBoxPath);
            #endregion

            #region Button Cancel.
            buttonCancel          = new Button();
            buttonCancel.Anchor   = AnchorStyles.Right | AnchorStyles.Bottom;
            buttonCancel.Location = new Point(Width - Padding.Right - buttonCancel.Width, Height - Padding.Bottom - buttonCancel.Height);
            buttonCancel.Text     = "Cancel";
            buttonCancel.Click   += (sender, args) =>
            {
                DialogResult = Forms.DialogResult.Cancel;
                Close();
            };
            Controls.Add(buttonCancel);
            #endregion

            #region Button Ok.
            buttonOk          = new Button();
            buttonOk.Anchor   = AnchorStyles.Bottom | AnchorStyles.Right;
            buttonOk.Location = new Point(buttonCancel.Location.X - buttonOk.Width - 8, buttonCancel.Location.Y);
            buttonOk.Text     = "Ok";
            buttonOk.Click   += (sender, args) => { OpenFile(); };
            Controls.Add(buttonOk);
            #endregion

            #region Label Filename.
            labelFilename           = new Label();
            labelFilename.Anchor    = AnchorStyles.Bottom | AnchorStyles.Left;
            labelFilename.Location  = new Point(8, buttonOk.Location.Y - 30);
            labelFilename.Size      = new Drawing.Size(64, 22);
            labelFilename.Text      = "File: ";
            labelFilename.TextAlign = ContentAlignment.MiddleRight;
            Controls.Add(labelFilename);
            #endregion

            #region Textbox Filename.
            textBoxFilename          = new TextBox();
            textBoxFilename.Anchor   = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            textBoxFilename.Location = new Point(labelFilename.Location.X + labelFilename.Width, labelFilename.Location.Y);
            textBoxFilename.Size     = new Drawing.Size(Width - 32 - (buttonOk.Width + 8 + buttonCancel.Width) - labelFilename.Width, 22);
            Controls.Add(textBoxFilename);
            #endregion

            #region Combobox Filter.
            comboFilter               = new ComboBox();
            comboFilter.Anchor        = AnchorStyles.Bottom | AnchorStyles.Right;
            comboFilter.DropDownStyle = ComboBoxStyle.DropDownList;
            comboFilter.Size          = new Drawing.Size(buttonOk.Width + 8 + buttonCancel.Width, 22);
            comboFilter.Location      = new Point(Width - Padding.Right - comboFilter.Width, textBoxFilename.Location.Y);
            Controls.Add(comboFilter);
            #endregion

            #region File Render.
            fileRenderer                     = new FileRenderer(this);
            fileRenderer.Anchor              = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
            fileRenderer.Location            = new Point(Padding.Left, buttonBack.Location.Y + buttonBack.Height + 8);
            fileRenderer.Name                = "fileRenderer";
            fileRenderer.Size                = new Drawing.Size(Width - Padding.Left - Padding.Right, textBoxFilename.Location.Y - buttonBack.Location.Y - buttonBack.Height - 16);
            fileRenderer.OnDirectoryChanged += () =>
            {
                if (fileRenderer.prevPathes.Count > 0)
                {
                    buttonBack.Enabled = true;
                }
                textBoxPath.Text = fileRenderer.currentPath;
            };
            fileRenderer.OnSelectedFileChanged += (file) =>
            {
                textBoxFilename.Text = file.ToString();
            };
            fileRenderer.OnFileOpen += (file) =>
            {
                OpenFile();
            };
            Controls.Add(fileRenderer);
            #endregion

            textBoxPath.Text         = fileRenderer.currentPath;
            textBoxPath.TextChanged += (sender, args) =>
            {
                fileRenderer.SetDirectory(textBoxPath.Text);
            };

            fileRenderer.filesTree.NodeMouseClick += filesTree_NodeMouseClick;

            AcceptButton = buttonOk;
            Shown       += FileDialog_Shown;
        }
Esempio n. 3
0
 /// <summary> 
 /// Required method for Designer support - do not modify 
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.toolStrip2 = new System.Windows.Forms.ToolStrip();
     this.cmdRunDemo = new System.Windows.Forms.ToolStripButton();
     this.lblTestDescription = new System.Windows.Forms.ToolStripLabel();
     this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
     this.splitFiles = new System.Windows.Forms.SplitContainer();
     this.fileOutput = new ExamplesFx.Controls.FileRenderer();
     this.toolStrip2.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.splitFiles)).BeginInit();
     this.splitFiles.Panel1.SuspendLayout();
     this.splitFiles.Panel2.SuspendLayout();
     this.splitFiles.SuspendLayout();
     this.SuspendLayout();
     //
     // toolStrip2
     //
     this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.cmdRunDemo,
     this.lblTestDescription});
     this.toolStrip2.Location = new System.Drawing.Point(0, 0);
     this.toolStrip2.Name = "toolStrip2";
     this.toolStrip2.Size = new System.Drawing.Size(866, 25);
     this.toolStrip2.TabIndex = 3;
     this.toolStrip2.Text = "toolStrip2";
     //
     // cmdRunDemo
     //
     this.cmdRunDemo.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.cmdRunDemo.Image = global::ExamplesFx.Properties.Resources.arrow_right;
     this.cmdRunDemo.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.cmdRunDemo.Name = "cmdRunDemo";
     this.cmdRunDemo.Size = new System.Drawing.Size(110, 25);
     this.cmdRunDemo.Text = "Run Demo";
     this.cmdRunDemo.Visible = false;
     this.cmdRunDemo.Click += new System.EventHandler(this.cmdRunDemo_Click);
     //
     // lblTestDescription
     //
     this.lblTestDescription.Name = "lblTestDescription";
     this.lblTestDescription.Size = new System.Drawing.Size(0, 22);
     //
     // tableLayoutPanel1
     //
     this.tableLayoutPanel1.AutoScroll = true;
     this.tableLayoutPanel1.ColumnCount = 1;
     this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
     this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
     this.tableLayoutPanel1.Name = "tableLayoutPanel1";
     this.tableLayoutPanel1.RowCount = 1;
     this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 400F));
     this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 400F));
     this.tableLayoutPanel1.Size = new System.Drawing.Size(866, 400);
     this.tableLayoutPanel1.TabIndex = 4;
     //
     // splitFiles
     //
     this.splitFiles.Dock = System.Windows.Forms.DockStyle.Fill;
     this.splitFiles.Location = new System.Drawing.Point(0, 25);
     this.splitFiles.Name = "splitFiles";
     //
     // splitFiles.Panel1
     //
     this.splitFiles.Panel1.Controls.Add(this.tableLayoutPanel1);
     //
     // splitFiles.Panel2
     //
     this.splitFiles.Panel2.Controls.Add(this.fileOutput);
     this.splitFiles.Panel2Collapsed = true;
     this.splitFiles.Size = new System.Drawing.Size(866, 400);
     this.splitFiles.SplitterDistance = 557;
     this.splitFiles.TabIndex = 5;
     //
     // fileOutput
     //
     this.fileOutput.ColorBotton = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
     this.fileOutput.ColorTop = System.Drawing.Color.Green;
     this.fileOutput.Dock = System.Windows.Forms.DockStyle.Fill;
     this.fileOutput.File = null;
     this.fileOutput.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.fileOutput.Location = new System.Drawing.Point(0, 0);
     this.fileOutput.Name = "fileOutput";
     this.fileOutput.Size = new System.Drawing.Size(96, 100);
     this.fileOutput.TabIndex = 0;
     //
     // ExampleRenderer
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.Controls.Add(this.splitFiles);
     this.Controls.Add(this.toolStrip2);
     this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
     this.Name = "ExampleRenderer";
     this.Size = new System.Drawing.Size(866, 425);
     this.toolStrip2.ResumeLayout(false);
     this.toolStrip2.PerformLayout();
     this.splitFiles.Panel1.ResumeLayout(false);
     this.splitFiles.Panel2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.splitFiles)).EndInit();
     this.splitFiles.ResumeLayout(false);
     this.ResumeLayout(false);
     this.PerformLayout();
 }