Пример #1
0
        public InboxView(FoldersTree foldersTree)
            : base("Inbox")
        {
            InitializeComponent();

            FoldersTree = foldersTree;
            SortOrderBase.DefaultSortOrder = CRSortOrder.SortOrder.Date;
        }
Пример #2
0
        /// <summary>
        /// Initialises a new instance of the <see cref="TopicView"/> class.
        /// </summary>
        /// <param name="foldersTree">The parent forum view</param>
        public TopicView(FoldersTree foldersTree)
            : base("Forums")
        {
            InitializeComponent();

            FoldersTree = foldersTree;
            SortOrderBase.DefaultSortOrder = CRSortOrder.SortOrder.Date;

            _tooltip = new ToolTip();
        }
Пример #3
0
        public DirectoryView(FoldersTree foldersTree)
            : base("Directory")
        {
            InitializeComponent();

            FoldersTree = foldersTree;
            SortOrderBase.DefaultSortOrder = CRSortOrder.SortOrder.Popularity;
            SortOrderBase.Ascending = false;

            _imageList.Images.Add(Resources.ReadLock);

            dvForumsList.SmallImageList = _imageList;
        }
Пример #4
0
 public WelcomeView(FoldersTree foldersTree)
     : base("Welcome")
 {
     FoldersTree = foldersTree;
     InitializeComponent();
 }
Пример #5
0
 /// <summary>
 /// Initialises a new instance of the <see cref="ForumsView"/> class.
 /// </summary>
 /// <param name="foldersTree">The parent forum view</param>
 public ForumsView(FoldersTree foldersTree)
     : base("Forums")
 {
     FoldersTree = foldersTree;
     InitializeComponent();
 }
Пример #6
0
        /// <summary>
        /// Initialises a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        internal MainForm()
        {
            InitializeComponent();

            _scriptManager = new ScriptManager(this);

            Initialise();

            _mainPanel = new Panel
            {
                Parent = this,
                Location = new Point(0, 0),
                Size = new Size(ClientRectangle.Width, ClientRectangle.Height),
                Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom,
            };
            Controls.Add(_mainPanel);

            Image cixLogoImage = Resources.CIXLogo2;

            _isBacktracking = true;

            Font titleFont = UI.Menu.Font;
            int menuHeight = Math.Max(titleFont.Height + 4, 42);

            // Top level menu panel
            _shortcutBar = new CRPanel
            {
                Parent = _mainPanel,
                Location = new Point(0, 0),
                Gradient = true,
                Size = new Size(_mainPanel.Width, menuHeight),
                Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right,
                BackColor = UI.Menu.BackgroundColour
            };
            _mainPanel.Controls.Add(_shortcutBar);

            // Add the CIX logo to the left edge of the shortcut bar
            PictureBox cixLogo = new PictureBox
            {
                Image = cixLogoImage,
                Location = new Point(4, (menuHeight - cixLogoImage.Height) / 2),
                Name = "cixlogo",
                Parent = _shortcutBar,
                BackColor = Color.Transparent,
                SizeMode = PictureBoxSizeMode.StretchImage,
                Visible = true,
                Size = cixLogoImage.Size
            };
            cixLogo.Click += delegate { Address = "welcome"; };
            _shortcutBar.Controls.Add(cixLogo);

            _labels = new List<CRLabel>();

            AddShortcut(Resources.Forums, Resources.ForumsTooltip, delegate { Address = "cix:_lastview"; });
            AddShortcut(Resources.PMessages, Resources.PMessagesTooltip, delegate { Address = "cixmailbox:inbox"; });
            AddShortcut(Resources.Directory, Resources.DirectoryTooltip, delegate { Address = "cixdirectory:all"; });
            AddShortcut(Resources.Support, Resources.SupportTooltip, delegate { Address = "cix:" + Constants.SupportForum; });

            if (Preferences.StandardPreferences.UseBeta)
            {
                AddShortcut(Resources.Beta, Resources.BetaTooltip, delegate { Address = "cix:" + Constants.BetaForum; });
            }

            // Add the control menu to the extreme right edge of the shortcut bar
            Image controlImage = Resources.Control;
            _controlMenu = new PictureBox
            {
                Anchor = AnchorStyles.Right | AnchorStyles.Top,
                Image = controlImage,
                Location = new Point(_mainPanel.Width - (controlImage.Width + 2), (menuHeight - controlImage.Height) / 2),
                Name = "controlMenu",
                Parent = _shortcutBar,
                BackColor = Color.Transparent,
                SizeMode = PictureBoxSizeMode.StretchImage,
                Visible = true,
                Size = controlImage.Size
            };
            _controlMenu.Click += ControlMenuOnClick;
            _controlMenu.MouseEnter += ControlMenuMouseEnter;
            _controlMenu.MouseLeave += ControlMenuMouseLeave;

            // Add the user's mugshot image. We don't have it yet. We'll
            // get it once the database is ready.
            Size imageSize = new Size(menuHeight - 4, menuHeight - 4);
            _logonImage = new PictureBox
            {
                Anchor = AnchorStyles.Right | AnchorStyles.Top,
                Location = new Point(_mainPanel.Width - (imageSize.Width + controlImage.Width + 2), 2),
                Name = "logonImage",
                Parent = _shortcutBar,
                SizeMode = PictureBoxSizeMode.StretchImage,
                Visible = true,
                Size = imageSize
            };

            // Add the user's name to the left of the image.
            Font logonNameFont = UI.GetFont(UI.Menu.Font, UIConfigMenu.FontSize - 10);
            string logonText = CIX.Username;
            SizeF nameSize = CreateGraphics().MeasureString(logonText, logonNameFont);

            int xPosition = _labels[_labels.Count - 1].Right;
            _logonName = new CRLabel
            {
                Anchor = AnchorStyles.Right | AnchorStyles.Top,
                AutoSize = true,
                Padding = new Padding(0, 1, 0, 0),
                Font = logonNameFont,
                ForeColor = UI.Menu.ForegroundColour,
                InactiveColour = UI.Menu.ForegroundColour,
                BackColor = Color.Transparent,
                Location = new Point(xPosition, (int)(menuHeight - nameSize.Height) / 2),
                Size = new Size(_logonImage.Left - xPosition, (int)nameSize.Height),
                Parent = _shortcutBar,
                Visible = true,
                Text = logonText
            };
            _shortcutBar.Controls.Add(_logonName);

            // Top level menu panel
            int dpi = GetDPI();
            _toolbar = new CRToolbar
            {
                Parent = _mainPanel,
                Location = new Point(0, menuHeight),
                Size = new Size(_mainPanel.Width, Math.Max(dpi / 3, 36)),
                Visible = false
            };

            // Add the panel for the view
            _viewPanel = new Panel
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Location = new Point(0, menuHeight),
                Size = new Size(ClientRectangle.Width, ClientRectangle.Height - menuHeight),
                Margin = new Padding(0),
                Name = "viewPanel",
                Tag = this,
                Parent = _mainPanel,
                TabIndex = _labels.Count
            };

            // Add the folders tree portion
            _foldersTree = new FoldersTree(this)
                {
                    TopLevel = false,
                    Location = new Point(0, 0),
                    Parent = _viewPanel,
                    Size = _viewPanel.Size
                };

            _mainPanel.Controls.Add(_viewPanel);
            _mainPanel.Controls.Add(_toolbar);

            // Good time to show the status bar if needed.
            mainStatusBar.ForeColor = UI.System.EdgeColour;
            mainStatusBar.BackColor = UI.System.InfoBarColour;

            mainMenubar.BackColor = UI.Menu.BackgroundColour;
            mainMenubar.ForeColor = UI.Menu.ForegroundColour;
            mainMenubar.Renderer = new MainMenuBarRenderer();

            ShowStatusBar(Preferences.StandardPreferences.ViewStatusBar);
            ShowMenuBar(Preferences.StandardPreferences.ViewMenuBar);
            ShowToolbar(Preferences.StandardPreferences.ShowToolBar);

            // Set the service online state now
            ChangeOnlineState(NetworkInterface.GetIsNetworkAvailable() && Program.StartupOnline);
        }