public ProjectManagerControl()
        {
            MetroSkinManager.ApplyMetroStyle(this);
            AutoScroll = true;

            m_optionsTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_optionsTile);
            m_optionsTile.Text      = "Options";
            m_optionsTile.TextAlign = ContentAlignment.MiddleCenter;
            m_optionsTile.Top       = DEFAULT_SEPARATOR;
            m_optionsTile.Width     = Width;
            m_optionsTile.Anchor    = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            m_optionsTile.Click    += new EventHandler(m_optionsTile_Click);
            Controls.Add(m_optionsTile);

            m_filesPanel = new MetroPanel();
            MetroSkinManager.ApplyMetroStyle(m_filesPanel);
            m_filesPanel.Size     = new Size(Width, 0);
            m_filesPanel.AutoSize = true;
            m_filesPanel.Top      = m_optionsTile.Bottom + DEFAULT_SEPARATOR;
            m_filesPanel.Width    = Width;
            m_filesPanel.Height   = Height - m_filesPanel.Top;
            m_filesPanel.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            Controls.Add(m_filesPanel);
        }
示例#2
0
        private void InitializeGeneral()
        {
            m_generalPanel = new MetroPanel();
            MetroSkinManager.ApplyMetroStyle(m_generalPanel);
            m_generalPanel.Size     = new Size();
            m_generalPanel.AutoSize = true;
            m_generalPanel.Left     = DEFAULT_SECTION_SEPARATOR;
            m_generalPanel.Top      = DEFAULT_SECTION_SEPARATOR;
            Controls.Add(m_generalPanel);

            MetroLabel title = new MetroLabel();

            MetroSkinManager.ApplyMetroStyle(title);
            title.Text     = "General";
            title.Size     = new Size();
            title.AutoSize = true;
            m_generalPanel.Controls.Add(title);

            m_generalNewProjectTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_generalNewProjectTile);
            m_generalNewProjectTile.Text     = "NEW\nPROJECT";
            m_generalNewProjectTile.Image    = Bitmap.FromFile("resources/icons/appbar.page.new.png");
            m_generalNewProjectTile.Size     = DEFAULT_TILE_SIZE;
            m_generalNewProjectTile.Location = new Point(DEFAULT_TILE_SEPARATOR.X, title.Bottom + DEFAULT_TILE_SEPARATOR.Y);
            m_generalNewProjectTile.Click   += new EventHandler(m_generalNewProjectTile_Click);
            m_generalPanel.Controls.Add(m_generalNewProjectTile);

            m_generalOpenProjectTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_generalOpenProjectTile);
            m_generalOpenProjectTile.Text     = "OPEN\nPROJECT";
            m_generalOpenProjectTile.Image    = Bitmap.FromFile("resources/icons/appbar.page.edit.png");
            m_generalOpenProjectTile.Size     = DEFAULT_TILE_SIZE;
            m_generalOpenProjectTile.Location = new Point(m_generalNewProjectTile.Right + DEFAULT_TILE_SEPARATOR.X, title.Bottom + DEFAULT_TILE_SEPARATOR.Y);
            m_generalOpenProjectTile.Click   += new EventHandler(m_generalOpenProjectTile_Click);
            m_generalPanel.Controls.Add(m_generalOpenProjectTile);

            m_generalImportProjectTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_generalImportProjectTile);
            m_generalImportProjectTile.Text     = "IMPORT\nPROJECT";
            m_generalImportProjectTile.Image    = Bitmap.FromFile("resources/icons/appbar.page.download.png");
            m_generalImportProjectTile.Size     = DEFAULT_TILE_SIZE;
            m_generalImportProjectTile.Location = new Point(m_generalOpenProjectTile.Right + DEFAULT_TILE_SEPARATOR.X, title.Bottom + DEFAULT_TILE_SEPARATOR.Y);
            m_generalImportProjectTile.Click   += new EventHandler(m_generalImportProjectTile_Click);
            m_generalPanel.Controls.Add(m_generalImportProjectTile);
        }
示例#3
0
        private void InitializeSpecific()
        {
            m_specificPanel = new MetroPanel();
            MetroSkinManager.ApplyMetroStyle(m_specificPanel);
            m_specificPanel.Size     = new Size();
            m_specificPanel.AutoSize = true;
            m_specificPanel.Left     = DEFAULT_SECTION_SEPARATOR;
            m_specificPanel.Top      = m_generalPanel.Bottom + DEFAULT_SECTION_SEPARATOR;
            Controls.Add(m_specificPanel);

            MetroLabel title = new MetroLabel();

            MetroSkinManager.ApplyMetroStyle(title);
            title.Text     = "Project-specific";
            title.Size     = new Size();
            title.AutoSize = true;
            m_specificPanel.Controls.Add(title);

            m_specificSaveProjectTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_specificSaveProjectTile);
            m_specificSaveProjectTile.Text     = "SAVE\nPROJECT";
            m_specificSaveProjectTile.Image    = Bitmap.FromFile("resources/icons/appbar.save.png");
            m_specificSaveProjectTile.Size     = DEFAULT_TILE_SIZE;
            m_specificSaveProjectTile.Location = new Point(DEFAULT_TILE_SEPARATOR.X, title.Bottom + DEFAULT_TILE_SEPARATOR.Y);
            m_specificSaveProjectTile.Click   += new EventHandler(m_specificSaveProjectTile_Click);
            m_specificPanel.Controls.Add(m_specificSaveProjectTile);

            m_specificExportProjectTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_specificExportProjectTile);
            m_specificExportProjectTile.Text     = "EXPORT\nPROJECT";
            m_specificExportProjectTile.Image    = Bitmap.FromFile("resources/icons/appbar.page.upload.png");
            m_specificExportProjectTile.Size     = DEFAULT_TILE_SIZE;
            m_specificExportProjectTile.Location = new Point(m_specificSaveProjectTile.Right + DEFAULT_TILE_SEPARATOR.X, title.Bottom + DEFAULT_TILE_SEPARATOR.Y);
            m_specificExportProjectTile.Click   += new EventHandler(m_specificExportProjectTile_Click);
            m_specificPanel.Controls.Add(m_specificExportProjectTile);

            m_specificCloseProjectTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_specificCloseProjectTile);
            m_specificCloseProjectTile.Text     = "CLOSE\nPROJECT";
            m_specificCloseProjectTile.Image    = Bitmap.FromFile("resources/icons/appbar.close.png");
            m_specificCloseProjectTile.Size     = DEFAULT_TILE_SIZE;
            m_specificCloseProjectTile.Location = new Point(m_specificExportProjectTile.Right + DEFAULT_TILE_SEPARATOR.X, title.Bottom + DEFAULT_TILE_SEPARATOR.Y);
            m_specificCloseProjectTile.Click   += new EventHandler(m_specificCloseProjectTile_Click);
            m_specificPanel.Controls.Add(m_specificCloseProjectTile);
        }
示例#4
0
        private void tile_Click(object sender, EventArgs e)
        {
            MetroTileIcon tile = sender as MetroTileIcon;

            if (tile == null)
            {
                return;
            }

            if (tile.Tag is int)
            {
                ResultOptionIndex = (int)tile.Tag;
            }
            if (tile.Tag != null)
            {
                DialogResult = DialogResult.OK;
            }
            Close();
        }
        private void tile_MouseUp(object sender, MouseEventArgs e)
        {
            MetroTileIcon tile = sender as MetroTileIcon;

            if (tile == null)
            {
                return;
            }

            string path = tile.Tag as string;

            if (e.Button == MouseButtons.Left)
            {
                if (Directory.Exists(path))
                {
                    ViewPath = path;
                }
                else if (File.Exists(path))
                {
                    OpenFile(path);
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                MetroContextMenu menu = new MetroContextMenu(null);
                MetroSkinManager.ApplyMetroStyle(menu);
                ToolStripMenuItem menuItem;

                menuItem        = new ToolStripMenuItem("Rename");
                menuItem.Tag    = path;
                menuItem.Click += new EventHandler(menuItem_rename_Click);
                menu.Items.Add(menuItem);

                menuItem        = new ToolStripMenuItem("Delete");
                menuItem.Tag    = path;
                menuItem.Click += new EventHandler(menuItem_delete_Click);
                menu.Items.Add(menuItem);

                menu.Show(tile, e.Location);
            }
        }
        private void button_Click_file(object sender, EventArgs e)
        {
            MetroTileIcon button = sender as MetroTileIcon;

            if (button == null || button.Tag == null)
            {
                return;
            }

            MetroTextBox textBox = button.Tag as MetroTextBox;

            if (textBox == null)
            {
                return;
            }

            OpenFileDialog dialog = new OpenFileDialog();

            dialog.CheckPathExists  = true;
            dialog.RestoreDirectory = true;
            if (!String.IsNullOrEmpty(textBox.Text))
            {
                dialog.FileName = Path.GetFullPath(textBox.Text);
            }
            dialog.Filter = "Executable file (*.exe)|*.exe";
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string path = dialog.FileName;
                result = MetroMessageBox.Show(FindForm(), "Keep relative path?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    path = Utils.GetRelativePath(path, Application.ExecutablePath);
                }
                textBox.Text = path;
            }
        }
        private void button_Click_dir(object sender, EventArgs e)
        {
            MetroTileIcon button = sender as MetroTileIcon;

            if (button == null || button.Tag == null)
            {
                return;
            }

            MetroTextBox textBox = button.Tag as MetroTextBox;

            if (textBox == null)
            {
                return;
            }

            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.ShowNewFolderButton = true;
            if (!String.IsNullOrEmpty(textBox.Text))
            {
                dialog.SelectedPath = Path.GetFullPath(textBox.Text);
            }
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string path = dialog.SelectedPath;
                result = MetroMessageBox.Show(FindForm(), "Keep relative path?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    path = Utils.GetRelativePath(path, Application.ExecutablePath);
                }
                textBox.Text = path;
            }
        }
示例#8
0
        public OpenFileWithDialog(string[] options, string defaultButton = "Default Application")
        {
            MetroSkinManager.ApplyMetroStyle(this);
            Text          = "Open File With";
            TextAlign     = MetroFormTextAlign.Center;
            Size          = new Size(DEFAULT_SIZE, 0);
            ShowInTaskbar = false;
            ControlBox    = false;
            Resizable     = false;
            DialogResult  = DialogResult.None;
            m_options     = options;

            MetroPanel panel = new MetroPanel();

            MetroSkinManager.ApplyMetroStyle(panel);
            panel.Size = new Size(DEFAULT_SIZE, 0);
            panel.Dock = DockStyle.Fill;
            Controls.Add(panel);

            int index = 0;

            m_contentHeight = 0;
            MetroTileIcon tile;

            if (m_options != null)
            {
                foreach (string opt in m_options)
                {
                    tile = new MetroTileIcon();
                    MetroSkinManager.ApplyMetroStyle(tile);
                    tile.Tag                = index;
                    tile.Width              = panel.Width;
                    tile.Height             = DEFAULT_BUTTON_HEIGHT;
                    tile.Top                = m_contentHeight;
                    tile.Text               = opt;
                    tile.TextAlign          = ContentAlignment.MiddleCenter;
                    tile.TileTextFontWeight = MetroTileTextWeight.Bold;
                    tile.Anchor             = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                    tile.Click             += new EventHandler(tile_Click);
                    panel.Controls.Add(tile);
                    m_contentHeight = tile.Bottom + DEFAULT_SEPARATOR;
                    ++index;
                }
            }

            tile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(tile);
            tile.Tag                = -1;
            tile.Width              = panel.Width;
            tile.Height             = DEFAULT_BUTTON_HEIGHT;
            tile.Top                = m_contentHeight;
            tile.Text               = defaultButton;
            tile.TextAlign          = ContentAlignment.MiddleCenter;
            tile.TileTextFontWeight = MetroTileTextWeight.Bold;
            tile.Anchor             = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            tile.Click             += new EventHandler(tile_Click);
            panel.Controls.Add(tile);
            m_contentHeight = tile.Bottom + DEFAULT_SEPARATOR;

            tile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(tile);
            tile.Width              = panel.Width;
            tile.Height             = DEFAULT_BUTTON_HEIGHT;
            tile.Top                = DEFAULT_SEPARATOR + DEFAULT_SEPARATOR + m_contentHeight;
            tile.Text               = "CANCEL";
            tile.TextAlign          = ContentAlignment.MiddleCenter;
            tile.TileTextFontWeight = MetroTileTextWeight.Bold;
            tile.Anchor             = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            tile.Click             += new EventHandler(tile_Click);
            panel.Controls.Add(tile);
            m_contentHeight = tile.Bottom;

            panel.Height = m_contentHeight;
            Height       = m_contentHeight + Padding.Vertical;
        }
示例#9
0
        public BuildPageControl()
        {
            MetroSkinManager.ApplyMetroStyle(this);
            AutoScroll = true;

            MetroLabel title = new MetroLabel();

            MetroSkinManager.ApplyMetroStyle(title);
            title.Text     = "Active target: ";
            title.Size     = new Size();
            title.AutoSize = true;
            title.Location = new Point(64, 64);
            Controls.Add(title);

            m_activeBuildComboBox = new MetroComboBox();
            MetroSkinManager.ApplyMetroStyle(m_activeBuildComboBox);
            m_activeBuildComboBox.BindingContext        = new BindingContext();
            m_activeBuildComboBox.Location              = new Point(title.Right, title.Top);
            m_activeBuildComboBox.SelectedValueChanged += new EventHandler(m_activeBuildComboBox_SelectedValueChanged);
            Controls.Add(m_activeBuildComboBox);

            m_progressSpinner = new MetroProgressSpinner();
            MetroSkinManager.ApplyMetroStyle(m_progressSpinner);
            m_progressSpinner.Visible  = false;
            m_progressSpinner.Size     = new Size(m_activeBuildComboBox.Height, m_activeBuildComboBox.Height);
            m_progressSpinner.Value    = -1;
            m_progressSpinner.Location = new Point(m_activeBuildComboBox.Right + DEFAULT_TILE_SEPARATOR.X, m_activeBuildComboBox.Top);
            Controls.Add(m_progressSpinner);

            m_buildTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_buildTile);
            m_buildTile.Text     = "BUILD";
            m_buildTile.Image    = Bitmap.FromFile("resources/icons/appbar.cog.png");
            m_buildTile.Size     = DEFAULT_TILE_SIZE;
            m_buildTile.Location = new Point(64, m_activeBuildComboBox.Bottom + DEFAULT_TILE_SEPARATOR.Y + DEFAULT_TILE_SEPARATOR.Y);
            m_buildTile.Click   += new EventHandler(m_buildTile_Click);
            Controls.Add(m_buildTile);

            m_rebuildTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_rebuildTile);
            m_rebuildTile.Text     = "REBUILD";
            m_rebuildTile.Image    = Bitmap.FromFile("resources/icons/appbar.cogs.png");
            m_rebuildTile.Size     = DEFAULT_TILE_SIZE;
            m_rebuildTile.Location = new Point(m_buildTile.Right + DEFAULT_TILE_SEPARATOR.X, m_buildTile.Top);
            m_rebuildTile.Click   += new EventHandler(m_rebuildTile_Click);
            Controls.Add(m_rebuildTile);

            m_cleanTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_cleanTile);
            m_cleanTile.Text     = "CLEAN";
            m_cleanTile.Image    = Bitmap.FromFile("resources/icons/appbar.delete.png");
            m_cleanTile.Size     = DEFAULT_TILE_SIZE;
            m_cleanTile.Location = new Point(m_rebuildTile.Right + DEFAULT_TILE_SEPARATOR.X, m_rebuildTile.Top);
            m_cleanTile.Click   += new EventHandler(m_cleanTile_Click);
            Controls.Add(m_cleanTile);

            m_buildAndRunTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_buildAndRunTile);
            m_buildAndRunTile.Text     = "BUILD && RUN";
            m_buildAndRunTile.Image    = Bitmap.FromFile("resources/icons/appbar.control.play.png");
            m_buildAndRunTile.Size     = DEFAULT_TILE_SIZE;
            m_buildAndRunTile.Location = new Point(m_buildTile.Left, m_buildTile.Bottom + DEFAULT_TILE_SEPARATOR.Y);
            m_buildAndRunTile.Click   += new EventHandler(m_buildAndRunTile_Click);
            Controls.Add(m_buildAndRunTile);

            m_runTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_runTile);
            m_runTile.Text     = "RUN";
            m_runTile.Image    = Bitmap.FromFile("resources/icons/appbar.control.play.png");
            m_runTile.Size     = DEFAULT_TILE_SIZE;
            m_runTile.Location = new Point(m_buildAndRunTile.Right + DEFAULT_TILE_SEPARATOR.X, m_buildAndRunTile.Top);
            m_runTile.Click   += new EventHandler(m_runTile_Click);
            Controls.Add(m_runTile);

            m_syncTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_syncTile);
            m_syncTile.Text     = "SYNC WITH\nCODE::BLOCKS";
            m_syncTile.Image    = Bitmap.FromFile("resources/icons/appbar.refresh.png");
            m_syncTile.Size     = DEFAULT_TILE_SIZE;
            m_syncTile.Location = new Point(m_runTile.Right + DEFAULT_TILE_SEPARATOR.X, m_runTile.Top);
            m_syncTile.Click   += new EventHandler(m_syncTile_Click);
            Controls.Add(m_syncTile);
        }
        private void InitializeContents()
        {
            MetroSkinManager.ApplyMetroStyle(this);
            Disposed  += new EventHandler(SettingsPageControl_Disposed);
            AutoScroll = true;

            MetroLabel    label;
            MetroTextBox  textBox;
            MetroTileIcon button;

            Width = 400;

            label = new MetroLabel();
            MetroSkinManager.ApplyMetroStyle(label);
            label.Size       = new Size();
            label.AutoSize   = true;
            label.Text       = "Toolset version: " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
            label.FontWeight = MetroLabelWeight.Bold;
            label.Location   = new Point(DEFAULT_SEPARATOR, DEFAULT_SEPARATOR);
            Controls.Add(label);

            label = new MetroLabel();
            MetroSkinManager.ApplyMetroStyle(label);
            label.Size     = new Size();
            label.AutoSize = true;
            label.Text     = "Ptakopysk SDK Location:";
            label.Location = new Point(DEFAULT_SEPARATOR, 64);
            Controls.Add(label);

            textBox = new MetroTextBox();
            MetroSkinManager.ApplyMetroStyle(textBox);
            textBox.Location     = new Point(DEFAULT_SEPARATOR, label.Bottom);
            textBox.Width        = Width - DEFAULT_SELECT_TILE_WIDTH - DEFAULT_SEPARATOR - DEFAULT_SEPARATOR;
            textBox.Anchor       = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            textBox.Text         = m_settingsModel.SdkPath;
            textBox.TextChanged += new EventHandler(textBox_TextChanged_sdk);
            Controls.Add(textBox);

            button = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(button);
            button.Tag        = textBox;
            button.Location   = new Point(textBox.Right, textBox.Top);
            button.Width      = DEFAULT_SELECT_TILE_WIDTH;
            button.Height     = textBox.Height;
            button.Anchor     = AnchorStyles.Top | AnchorStyles.Right;
            button.Image      = Bitmap.FromFile("resources/icons/appbar.select.mini.png");
            button.ImageAlign = ContentAlignment.MiddleCenter;
            button.Click     += new EventHandler(button_Click_dir);
            Controls.Add(button);

            label = new MetroLabel();
            MetroSkinManager.ApplyMetroStyle(label);
            label.Size     = new Size();
            label.AutoSize = true;
            label.Text     = "Code::Blocks IDE with MinGW Location:";
            label.Location = new Point(DEFAULT_SEPARATOR, textBox.Bottom + DEFAULT_SEPARATOR);
            Controls.Add(label);

            textBox = new MetroTextBox();
            MetroSkinManager.ApplyMetroStyle(textBox);
            textBox.Location     = new Point(DEFAULT_SEPARATOR, label.Bottom);
            textBox.Width        = Width - DEFAULT_SELECT_TILE_WIDTH - DEFAULT_SEPARATOR - DEFAULT_SEPARATOR;
            textBox.Anchor       = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            textBox.Text         = m_settingsModel.CodeBlocksIdePath;
            textBox.TextChanged += new EventHandler(textBox_TextChanged_cb);
            Controls.Add(textBox);

            button = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(button);
            button.Tag        = textBox;
            button.Location   = new Point(textBox.Right, textBox.Top);
            button.Width      = DEFAULT_SELECT_TILE_WIDTH;
            button.Height     = textBox.Height;
            button.Anchor     = AnchorStyles.Top | AnchorStyles.Right;
            button.Image      = Bitmap.FromFile("resources/icons/appbar.select.mini.png");
            button.ImageAlign = ContentAlignment.MiddleCenter;
            button.Click     += new EventHandler(button_Click_dir);
            Controls.Add(button);

            label = new MetroLabel();
            MetroSkinManager.ApplyMetroStyle(label);
            label.Size     = new Size();
            label.AutoSize = true;
            label.Text     = "Application Style:";
            label.Location = new Point(DEFAULT_SEPARATOR, textBox.Bottom + DEFAULT_SEPARATOR);
            Controls.Add(label);

            m_styleComboBox = new MetroComboBox();
            MetroSkinManager.ApplyMetroStyle(m_styleComboBox);
            m_styleComboBox.Location = new Point(DEFAULT_SEPARATOR, label.Bottom);
            Controls.Add(m_styleComboBox);

            label = new MetroLabel();
            MetroSkinManager.ApplyMetroStyle(label);
            label.Size     = new Size();
            label.AutoSize = true;
            label.Text     = "Application Theme:";
            label.Location = new Point(DEFAULT_SEPARATOR, m_styleComboBox.Bottom + DEFAULT_SEPARATOR);
            Controls.Add(label);

            m_themeComboBox = new MetroComboBox();
            MetroSkinManager.ApplyMetroStyle(m_themeComboBox);
            m_themeComboBox.Location = new Point(DEFAULT_SEPARATOR, label.Bottom);
            Controls.Add(m_themeComboBox);
        }
示例#11
0
        public MetroSidePanel()
        {
            MetroSkinManager.ApplyMetroStyle(this);
            m_moveAnim = new MoveAnimation();
            Padding    = new Padding(4);

            MetroPanel contentPanel = new MetroPanel();

            MetroSkinManager.ApplyMetroStyle(contentPanel);
            contentPanel.Dock = DockStyle.Fill;
            Controls.Add(contentPanel);

            m_content = new MetroPanel();
            MetroSkinManager.ApplyMetroStyle(m_content);
            m_content.Dock = DockStyle.Fill;
            m_content.Controls.Clear();
            m_content.ControlAdded   += new ControlEventHandler(m_content_ControlAdded);
            m_content.ControlRemoved += new ControlEventHandler(m_content_ControlRemoved);
            contentPanel.Controls.Add(m_content);

            m_contentScrollbarV = new MetroScrollBar(MetroScrollOrientation.Vertical);
            MetroSkinManager.ApplyMetroStyle(m_contentScrollbarV);
            m_contentScrollbarV.Dock    = DockStyle.Right;
            m_contentScrollbarV.Scroll += new ScrollEventHandler(m_contentScrollbarV_Scroll);
            contentPanel.Controls.Add(m_contentScrollbarV);

            m_contentScrollbarH = new MetroScrollBar(MetroScrollOrientation.Horizontal);
            MetroSkinManager.ApplyMetroStyle(m_contentScrollbarH);
            m_contentScrollbarH.Dock    = DockStyle.Bottom;
            m_contentScrollbarH.Scroll += new ScrollEventHandler(m_contentScrollbarH_Scroll);
            contentPanel.Controls.Add(m_contentScrollbarH);

            MetroPanel titlePanel = new MetroPanel();

            MetroSkinManager.ApplyMetroStyle(titlePanel);
            titlePanel.Height = 20;
            titlePanel.Dock   = DockStyle.Top;
            Controls.Add(titlePanel);

            m_titleBar = new MetroTile();
            MetroSkinManager.ApplyMetroStyle(m_titleBar);
            m_titleBar.Text   = "SidePanelControler";
            m_titleBar.Height = titlePanel.Height;
            m_titleBar.Click += new EventHandler(m_titleBar_Click);
            titlePanel.Controls.Add(m_titleBar);

            m_dockImage   = Bitmap.FromFile("resources/icons/appbar.pin.png");
            m_undockImage = Bitmap.FromFile("resources/icons/appbar.pin.remove.png");
            m_dockTile    = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_dockTile);
            m_dockTile.Size          = new Size(titlePanel.Height, titlePanel.Height);
            m_dockTile.Image         = m_dockImage;
            m_dockTile.ImageAlign    = ContentAlignment.MiddleCenter;
            m_dockTile.IsImageScaled = true;
            m_dockTile.ImageScale    = new PointF(0.5f, 0.5f);
            m_dockTile.Click        += new EventHandler(m_dockTile_Click);
            titlePanel.Controls.Add(m_dockTile);

            Load          += new EventHandler(SidePanelControl_Load);
            ParentChanged += new EventHandler(SidePanelControl_ParentChanged);

            Fit();
            Apply();
            UpdateScrollbars();
        }
        public void RebuildList()
        {
            m_content.Controls.Clear();

            if (m_viewPath == null || m_rootPath == null)
            {
                m_viewPath = m_rootPath;
            }

            if (m_viewPath == null || !Directory.Exists(m_viewPath))
            {
                return;
            }

            string root      = Path.GetFullPath(m_rootPath);
            string path      = Path.GetFullPath(m_viewPath);
            bool   upDownRow = false;
            int    x         = DEFAULT_SEPARATOR;

            MetroTileIcon tile;
            bool          isRoot = path.Length == root.Length;
            DirectoryInfo dir    = new DirectoryInfo(path);

            if (!dir.Exists)
            {
                return;
            }

            if (!isRoot)
            {
                tile = new MetroTileIcon();
                MetroSkinManager.ApplyMetroStyle(tile);
                tile.Tag           = dir.FullName + @"\..";
                tile.Top           = DEFAULT_SEPARATOR;
                tile.Left          = x;
                tile.Size          = DEFAULT_TILE_SIZE;
                tile.Image         = m_backImage;
                tile.IsImageScaled = true;
                tile.ImageScale    = new PointF(0.85f, 0.85f);
                tile.MouseUp      += new MouseEventHandler(tile_MouseUp);
                m_content.Controls.Add(tile);
                upDownRow = !upDownRow;
            }
            foreach (DirectoryInfo info in dir.GetDirectories())
            {
                tile = new MetroTileIcon();
                MetroSkinManager.ApplyMetroStyle(tile);
                tile.Tag                = info.FullName;
                tile.Top                = upDownRow ? (DEFAULT_SEPARATOR + DEFAULT_TILE_SIZE.Height + DEFAULT_SEPARATOR) : DEFAULT_SEPARATOR;
                tile.Left               = x;
                tile.Size               = DEFAULT_TILE_SIZE;
                tile.Text               = info.Name;
                tile.TextAlign          = ContentAlignment.BottomRight;
                tile.TileTextFontSize   = MetroTileTextSize.Small;
                tile.TileTextFontWeight = MetroTileTextWeight.Regular;
                tile.Image              = m_dirImage;
                tile.IsImageScaled      = true;
                tile.ImageScale         = new PointF(0.85f, 0.85f);
                tile.ImageAlign         = ContentAlignment.TopLeft;
                tile.ImageOffset        = new Point(-10, -10);
                tile.MouseUp           += new MouseEventHandler(tile_MouseUp);
                m_content.Controls.Add(tile);
                upDownRow = !upDownRow;
                if (!upDownRow)
                {
                    x += DEFAULT_TILE_SIZE.Width + DEFAULT_SEPARATOR;
                }
            }
            string ext;

            foreach (FileInfo info in dir.GetFiles())
            {
                ext  = Path.GetExtension(info.Name);
                tile = new MetroTileIcon();
                MetroSkinManager.ApplyMetroStyle(tile);
                tile.Tag                = info.FullName;
                tile.Top                = upDownRow ? (DEFAULT_SEPARATOR + DEFAULT_TILE_SIZE.Height + DEFAULT_SEPARATOR) : DEFAULT_SEPARATOR;
                tile.Left               = x;
                tile.Size               = DEFAULT_TILE_SIZE;
                tile.Text               = ext + "\n" + Path.GetFileNameWithoutExtension(info.Name);
                tile.TextAlign          = ContentAlignment.BottomRight;
                tile.TileTextFontSize   = MetroTileTextSize.Small;
                tile.TileTextFontWeight = MetroTileTextWeight.Regular;
                if (ext == ".h" || ext == ".cpp")
                {
                    tile.Image = m_fileCodeImage;
                }
                else if (ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".bmp")
                {
                    tile.Image = m_fileImageImage;
                }
                else if (ext == ".ogg" || ext == ".mp3" || ext == ".wav")
                {
                    tile.Image = m_fileMusicImage;
                }
                else if (ext == ".txt" || ext == ".log")
                {
                    tile.Image = m_fileTextImage;
                }
                else if (ext == ".json" || ext == ".xml")
                {
                    tile.Image = m_fileDomImage;
                }
                else
                {
                    tile.Image = m_fileImage;
                }
                tile.IsImageScaled = true;
                tile.ImageScale    = new PointF(0.85f, 0.85f);
                tile.ImageAlign    = ContentAlignment.TopLeft;
                tile.ImageOffset   = new Point(-10, -10);
                tile.MouseUp      += new MouseEventHandler(tile_MouseUp);
                m_content.Controls.Add(tile);
                upDownRow = !upDownRow;
                if (!upDownRow)
                {
                    x += DEFAULT_TILE_SIZE.Width + DEFAULT_SEPARATOR;
                }
            }

            if (SidePanel != null)
            {
                SidePanel.UpdateScrollbars();
            }
        }