コード例 #1
0
 /// <summary>
 /// Closes the spesific tab window and send tabs back into correct places.
 /// </summary>
 /// <param name="sender">TabWindow object.</param>
 /// <param name="e">Event</param>
 private void CloseWindow(Object sender, CancelEventArgs e)
 {
     // Try catch to make sure that the program won't break.
     try
     {
         TabWindow tab = (TabWindow)sender;
         if (tab.TabablzControl.Items.Count != 0)
         {
             // Items have to be moved in to separate collection to remove references to parents.
             ObservableCollection <MetroTabItem> items = new ObservableCollection <MetroTabItem>();
             foreach (MetroTabItem item in tab.TabablzControl.Items)
             {
                 items.Add(item);
             }
             foreach (MetroTabItem item in items)
             {
                 var parent = (TabablzControl)item.Parent;
                 if (parent != null)
                 {
                     parent.RemoveFromSource(item);
                 }
                 TControl.RemoveFromSource(item);
                 TControl.AddToSource(item);
             }
         }
         // Select one of the tabs;
         MetroTabItem metroItem = (MetroTabItem)TControl.Items.GetItemAt(0);
         metroItem.IsSelected = true;
     }
     catch
     {
     }
 }
コード例 #2
0
        /// <summary>
        /// Creates a tab for the given language
        /// </summary>
        /// <param name="lang"></param>
        private void CreateLocalizedTab(Language lang)
        {
            // Create a tab item
            MetroTabItem tabItem = CreateMetroTabItem(lang);
            // Creates a grid for under the tab item, with a style defined in the styles.xaml file
            Grid tabGrid = new Grid {
                Style = Application.Current.Resources["GridBelowTabItem"] as Style
            };

            //Creates a wrappanel, so the stackpanel with the labels and the stackpanel with the input are nicely next to eachother
            WrapPanel wrapForStacks = new WrapPanel {
                HorizontalAlignment = HorizontalAlignment.Center
            };

            // Stackpanel for the labels
            StackPanel stackPanelLeft = CreateLeftStackPanelForLabels(lang);
            // Stackpanel for the input fields (Name, Plural name)
            StackPanel stackPanelRight = CreateRightStackPanelForInput(lang);

            // Adds the stackpanels to the wrappanel
            wrapForStacks.Children.Add(stackPanelLeft);
            wrapForStacks.Children.Add(stackPanelRight);

            // Adds the wrappanel to the grid
            tabGrid.Children.Add(wrapForStacks);

            // Adds the grid to the tabItem
            tabItem.Content = tabGrid;

            // Adds the tabItem to the tabControl
            TabControlLanguages.Items.Add(tabItem);
        }
コード例 #3
0
        private void pages_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.Source is MetroAnimatedTabControl)
            {
                MetroAnimatedTabControl tabControl = sender as MetroAnimatedTabControl;
                MetroTabItem            tabItem    = tabControl.SelectedItem as MetroTabItem;

                switch (tabItem.Header)
                {
                case "Friends":
                    UpdateFriends();
                    break;

                case "Photos":
                    UpdatePhotos();
                    break;

                case "Groups":
                    UpdateGroups();
                    break;

                default:
                    break;
                }
            }
        }
コード例 #4
0
ファイル: MetroShellEx.cs プロジェクト: hklang/JJStart
        /// <summary>
        /// 重写双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _MetroTabItem_DoubleClick(object sender, EventArgs e)
        {
            //过滤掉“Plugins”
            if (_MetroTabItem.Text == "Plugins")
            {
                return;
            }

            //填充相关信息
            this._NameEdit.Clear();
            this._NameEdit.Location        = new Point(_MetroTabItem.DisplayRectangle.Location.X + 3, _MetroTabItem.DisplayRectangle.Location.Y + 6);
            this._NameEdit.Size            = _MetroTabItem.DisplayRectangle.Size;
            this._NameEdit.Text            = _MetroTabItem.Text;
            this._NameEdit.SelectionLength = this._NameEdit.TextLength;
            this._NameEdit.SelectAll();
            this._NameEdit.ScrollToCaret();

            //显现
            this._NameEdit.Show();

            //获取焦点
            this._NameEdit.Focus();

            //添加到最前面
            this.Controls.SetChildIndex(this._NameEdit, 0);

            //记录一下
            this._MetroTabItemLastShow = this._MetroTabItem;
        }
コード例 #5
0
        private void CreateLocalizedTab(Language lang)
        {
            // Creates a tab item
            MetroTabItem tabItem = CreateMetroTabItem(lang);
            // Creates a grid for under the tab item
            Grid tabGrid = new Grid {
                Style = Application.Current.Resources["GridBelowTabItem"] as Style
            };

            // Defines 2 grid Columns so the content can be put into 2 equal columns
            tabGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            tabGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            // Create a stackpanel for the labels and put it in the left column of the grid
            StackPanel stackPanelLeft = CreateLeftStackPanelForLabels(lang);

            tabGrid.Children.Add(stackPanelLeft);
            Grid.SetColumn(stackPanelLeft, 0);

            // Create a stackpanel for the input fields and put it in the right column of the grid
            StackPanel stackPanelRight = CreateRightStackPanelForInput(lang);

            tabGrid.Children.Add(stackPanelRight);
            Grid.SetColumn(stackPanelRight, 1);

            tabItem.Content = tabGrid;

            TabControlLanguages.Items.Add(tabItem);
        }
コード例 #6
0
        /// <summary>
        /// 添加一个选项卡
        /// </summary>
        /// <param name="tabName">选项卡标题</param>
        /// <param name="uniqueKey">唯一标识符,用于区别于其他选项卡</param>
        /// <param name="form">要被添加到选项卡的窗体</param>
        /// <param name="isSelected">是否选中</param>
        /// <param name="isFill">是否填满</param>
        public void CreateTab(string tabName, string uniqueKey, Form form, bool isSelected, bool isFill)
        {
            MetroTabItem metroTabItem = GetMetroTabItem(uniqueKey);

            if (metroTabItem == null)
            {
                form.FormBorderStyle = FormBorderStyle.None;
                form.TopLevel        = false;
                form.Visible         = true;
                if (isFill)
                {
                    form.Dock = DockStyle.Fill;
                }
                else
                {
                    form.Dock = DockStyle.None;
                }


                metroTabItem            = metroShell.CreateTab(tabName, tabName);
                metroTabItem.GlobalName = uniqueKey;

                metroTabItem.Panel.AutoScroll = true;
                if (!isFill)
                {
                    metroTabItem.Panel.SizeChanged += new EventHandler(Panel_SizeChanged);
                }
                metroTabItem.Panel.Controls.Add(form);
            }

            if (isSelected)
            {
                metroTabItem.Select();
            }
        }
コード例 #7
0
        public void UpdateTabs()
        {
            var tab = MainWindow.Instance.characterTabSelect;

            tab.Items.Clear();
            int selected = -1;

            for (int i = 0; i < MainWindow.CurrentProject.data.characters.Count; i++)
            {
                var character = MainWindow.CurrentProject.data.characters[i];
                if (character == _character)
                {
                    selected = i;
                }
                MetroTabItem tabItem = CreateTab(character);
                tab.Items.Add(tabItem);
            }
            if (selected != -1)
            {
                tab.SelectedIndex = selected;
            }

            if (tab.SelectedItem is null)
            {
                MainWindow.Instance.characterTabGrid.IsEnabled             = false;
                MainWindow.Instance.characterTabGrid.Visibility            = Visibility.Collapsed;
                MainWindow.Instance.characterTabGridNoSelection.Visibility = Visibility.Visible;
            }
            else
            {
                MainWindow.Instance.characterTabGrid.IsEnabled             = true;
                MainWindow.Instance.characterTabGrid.Visibility            = Visibility.Visible;
                MainWindow.Instance.characterTabGridNoSelection.Visibility = Visibility.Collapsed;
            }
        }
コード例 #8
0
        /// <summary>
        /// 关闭选项卡
        /// </summary>
        /// <param name="uniqueKey">唯一标识符</param>
        public void CloseTab(string uniqueKey)
        {
            IEnumerable <MetroTabItem> metroTabItems = this.metroShell.Items.OfType <MetroTabItem>();

            if (metroTabItems.Count() == 1)
            {
                MessageBoxEx.Show("至少保留一个选项卡", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            MetroTabItem metroTabItem = GetMetroTabItem(uniqueKey);

            if (metroTabItem == null)
            {
                return;
            }

            IEnumerable <Form> forms = metroTabItem.Panel.Controls.OfType <Form>();

            foreach (Form form in forms)
            {
                form.Close();
            }

            this.metroShell.Items.Remove(metroTabItem);
            // 选择最后一个MetroTabItem
            this.metroShell.SelectedTab = this.metroShell.Items.OfType <MetroTabItem>().LastOrDefault();
        }
コード例 #9
0
        public DialogueTabViewModel()
        {
            MainWindow.Instance.dialogueTabSelect.SelectionChanged += DialogueTabSelect_SelectionChanged;
            MainWindow.Instance.dialogueTabButtonAdd.Click         += DialogueTabButtonAdd_Click;
            NPCDialogue empty = new NPCDialogue();

            Dialogue = empty;
            UpdateTabs();

            ContextMenu cmenu = new ContextMenu();

            cmenu.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCResponse), (result) =>
            {
                if (result is NPCResponse npcr)
                {
                    AddResponse(new Dialogue_Response(npcr));
                }
            }));

            MainWindow.Instance.dialogueAddReplyButton.ContextMenu = cmenu;

            ContextMenu cmenu2 = new ContextMenu();

            cmenu2.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCMessage), (result) =>
            {
                if (result is NPCMessage npcm)
                {
                    AddMessage(new Dialogue_Message(npcm));
                }
            }));

            MainWindow.Instance.dialogueAddMessageButton.ContextMenu = cmenu2;

            ContextMenu cmenu3 = new ContextMenu();

            cmenu3.Items.Add(ContextHelper.CreateAddFromTemplateButton(typeof(NPCDialogue), (result) =>
            {
                if (result is NPCDialogue npcd)
                {
                    MainWindow.CurrentProject.data.dialogues.Add(npcd);
                    MetroTabItem tabItem = CreateTab(npcd);
                    MainWindow.Instance.dialogueTabSelect.Items.Add(tabItem);
                    MainWindow.Instance.dialogueTabSelect.SelectedIndex = MainWindow.Instance.dialogueTabSelect.Items.Count - 1;
                }
            }));

            MainWindow.Instance.dialogueTabButtonAdd.ContextMenu = cmenu3;

            var dialogueInputIdControlContext = new ContextMenu();

            dialogueInputIdControlContext.Items.Add(ContextHelper.CreateFindUnusedIDButton((id) =>
            {
                this.ID = id;
                MainWindow.Instance.dialogueInputIdControl.Value = id;
            }, GameIntegration.EGameAssetCategory.NPC));

            MainWindow.Instance.dialogueInputIdControl.ContextMenu = dialogueInputIdControlContext;
        }
コード例 #10
0
ファイル: MainWindow.xaml.cs プロジェクト: lot224/SoundBoard
        private void help_Click(object sender, RoutedEventArgs e)
        {
            MetroTabItem tab = new MetroTabItem();

            tab.Header = "welcome";
            CreateHelpContent(tab);
            Tabs.Items.Add(tab);
            tab.Focus();
        }
コード例 #11
0
        private void CharacterTabButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            NPCCharacter item = new NPCCharacter();

            MainWindow.CurrentProject.data.characters.Add(item);
            MetroTabItem tabItem = CreateTab(item);

            MainWindow.Instance.characterTabSelect.Items.Add(tabItem);
            MainWindow.Instance.characterTabSelect.SelectedIndex = MainWindow.Instance.characterTabSelect.Items.Count - 1;
        }
コード例 #12
0
        private void DialogueTabButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            NPCDialogue item = new NPCDialogue();

            MainWindow.CurrentProject.data.dialogues.Add(item);
            MetroTabItem tabItem = CreateTab(item);

            MainWindow.Instance.dialogueTabSelect.Items.Add(tabItem);
            MainWindow.Instance.dialogueTabSelect.SelectedIndex = MainWindow.Instance.dialogueTabSelect.Items.Count - 1;
        }
コード例 #13
0
ファイル: MainWindow.xaml.cs プロジェクト: lot224/SoundBoard
        public MainWindow()
        {
            InitializeComponent();

            This = this;

            // make it a routed eventhandler so it'll get events already handled
            keyDownHandler = new RoutedEventHandler(RoutedKeyDownHandler);
            AddHandler(KeyDownEvent, keyDownHandler, true);
            AddHandler(KeyUpEvent, new KeyEventHandler(KeyUpHandler), true);
            Closing += new System.ComponentModel.CancelEventHandler(FormClosingHandler);

            RightWindowCommandsOverlayBehavior = WindowCommandsOverlayBehavior.Never;

            try
            {
                // try to load settings
                XmlDocument xmlDocument = new XmlDocument();

                xmlDocument.Load("soundboard.config");

                XmlElement  xelRoot  = xmlDocument.DocumentElement;
                XmlNodeList tabNodes = xelRoot.SelectNodes("/tabs/tab");

                // remove default tabs
                Tabs.Items.Clear();

                foreach (XmlNode node in tabNodes)
                {
                    string name = node["name"].InnerText;

                    MetroTabItem tab = new MetroTabItem();
                    tab.Header = name;
                    Tabs.Items.Add(tab);

                    List <Tuple <string, string> > buttons = new List <Tuple <string, string> >();

                    // read the button data
                    for (int i = 0; i < 10; ++i)
                    {
                        buttons.Add(new Tuple <string, string>(node["button" + i].Attributes["name"].Value, node["button" + i].Attributes["path"].Value));
                    }

                    CreatePageContent(tab, buttons);
                }
            }
            // didn't work? make new stuff!
            catch
            {
                // populate content for "welcome"
                CreateHelpContent((MetroTabItem)Tabs.Items[0]);
            }

            CreateTabContextMenus();
        }
コード例 #14
0
ファイル: MainWindow.xaml.cs プロジェクト: lot224/SoundBoard
        private void FormClosingHandler(object sender, EventArgs e)
        {
            string filename = "soundboard.config";

            using (FileStream fileStream = new FileStream(filename, FileMode.Create))
                using (StreamWriter sw = new StreamWriter(fileStream))
                    using (XmlTextWriter writer = new XmlTextWriter(sw))
                    {
                        writer.Formatting  = Formatting.Indented;
                        writer.Indentation = 4;

                        writer.WriteStartDocument();
                        writer.WriteStartElement("tabs");

                        for (int i = 0; i < Tabs.Items.Count; ++i)
                        {
                            MetroTabItem tab = (MetroTabItem)Tabs.Items[i];
                            if (tab.Content is Grid)
                            {
                                string name = tab.Header.ToString();
                                writer.WriteStartElement("tab");

                                writer.WriteElementString("name", name);


                                {
                                    Grid grid = (Grid)tab.Content;
                                    int  j    = 0;
                                    foreach (var child in grid.Children)
                                    {
                                        if (child is SoundButton)
                                        {
                                            SoundButton button = (SoundButton)child;
                                            writer.WriteStartElement("button" + j++);
                                            writer.WriteAttributeString("name", button.GetFileName());
                                            writer.WriteAttributeString("path", button.GetFile());
                                            //writer.WriteString("test");
                                            writer.WriteEndElement();
                                        }
                                    }
                                }

                                writer.WriteEndElement();
                            }
                            else // it doesn't have a grid, so it's not a sound page
                            {
                                continue;
                            }
                        }

                        writer.WriteEndElement();
                        writer.WriteEndDocument();
                    }
        }
コード例 #15
0
ファイル: MainWindow.xaml.cs プロジェクト: lot224/SoundBoard
        private void addPage_Click(object sender, RoutedEventArgs e)
        {
            MetroTabItem tab = new MetroTabItem();

            tab.Header = "new page";
            CreatePageContent(tab);
            Tabs.Items.Add(tab);
            tab.Focus();

            // make sure the new tab has a context menu
            CreateTabContextMenus();
        }
コード例 #16
0
        private void CloseTabExecute(object tabitem)
        {
            MetroTabItem item = tabitem as MetroTabItem;

            if (item == null)
            {
                return;
            }
            if (this.tblMainRegion.Items != null && this.tblMainRegion.Items.Contains(tabitem))
            {
                this.tblMainRegion.Items.Remove(tabitem);
            }
        }
コード例 #17
0
        private void BtnCreateClick(object sender, RoutedEventArgs e)
        {
            MetroTabItem item = new MetroTabItem
            {
                Header             = "Create new PC",
                CloseButtonEnabled = true,
            };

            Views.CreateForm view = new Views.CreateForm();
            item.Content = view;

            MainTabControl.Items.Add(item);
            item.Focus();
        }
コード例 #18
0
ファイル: MainWindow.xaml.cs プロジェクト: lot224/SoundBoard
        private async void renamePage_Click(object sender, RoutedEventArgs e)
        {
            RemoveHandler(KeyDownEvent, keyDownHandler);

            string result = await this.ShowInputAsync("Rename", "Whaddya wanna call it?");

            if (result != null && result != "")
            {
                MetroTabItem tab = (MetroTabItem)Tabs.SelectedItem;
                tab.Header = result;
            }

            AddHandler(KeyDownEvent, keyDownHandler, true);
        }
コード例 #19
0
        private void BtnFilterClick(object sender, RoutedEventArgs e)
        {
            MetroTabItem item = new MetroTabItem
            {
                Header             = "Filter",
                CloseButtonEnabled = true,
            };

            Views.Filter view = new Views.Filter();
            item.Content = view;

            MainTabControl.Items.Add(item);
            item.Focus();
        }
コード例 #20
0
        private void AbrirTabItem(string titulo, UserControl janela)
        {
            var novaTab = new MetroTabItem {
                Header = titulo, Content = janela, CloseButtonEnabled = true
            };

            foreach (var tabItem in TabControl.Items.Cast <TabItem>().Where(tabItem => tabItem.Header == novaTab.Header))
            {
                tabItem.Focus();
                return;
            }

            TabControl.Items.Add(novaTab);
            novaTab.Focus();
        }
コード例 #21
0
        void ShowForm(string header, string name, FinanceForm form)
        {
            var tabControl = FindMetroTabControl(name);

            if (tabControl != null)
            {
                var mainTabItem = FindMainTabItem(tabControl);
                if (null != mainTabItem)
                {
                    mainTabItem.IsSelected = true;


                    var tabName = SUB_TAB_PREFIX + name;
                    var me      = MainMenuTab.FindName(tabName) as MetroTabItem;
                    if (me != null)
                    {
                        me.IsSelected = true;
                        return;
                    }

                    if (form is FormUdefReport)
                    {
                        form.Name = name;
                        var frmUdfReport = form as FormUdefReport;
                        frmUdfReport.xTitle = header;
                        frmUdfReport.ShowSelectedItemEvent += (id) =>
                        {
                            var frmVoucher = FindForm("voucher_input") as FormVoucher;
                            if (frmVoucher == null)
                            {
                                frmVoucher = new FormVoucher();
                            }
                            frmVoucher.VoucherId = id;
                            ShowForm("凭证录入", "voucher_input", frmVoucher);
                        };
                    }

                    MetroTabItem tabItem = new MetroTabItem();
                    tabItem.Header  = header;
                    tabItem.Content = form;
                    tabItem.Name    = tabName;
                    tabControl.Items.Add(tabItem);
                    MainMenuTab.RegisterName(tabName, tabItem);
                    tabItem.IsSelected   = true;
                    tabItem.ButtonClick += TabItem_ButtonClick;
                }
            }
        }
コード例 #22
0
ファイル: Explorer.xaml.cs プロジェクト: junkdood/Otokoneko
        private void PreviewMouseLeftButtonDownHandler(object sender, MouseButtonEventArgs e)
        {
            if (!(e.Source is MetroTabItem tabItem))
            {
                e.Handled      = false;
                _validDragItem = null;
                return;
            }

            _mouseDownItem     = tabItem;
            _dragStartPosition = e.GetPosition(this);
            _validDragItem     =
                ((dynamic)DataContext).IsDraggable(tabItem.DataContext)
                    ? tabItem
                    : null;
        }
コード例 #23
0
ファイル: MainWindow.xaml.cs プロジェクト: judypol/ccw
        private void AddOneTab(String groupName)
        {
            MetroTabItem metroTabItem = new MetroTabItem();

            metroTabItem.Name               = groupName;
            metroTabItem.Header             = groupName;
            metroTabItem.CloseButtonEnabled = true;

            ListBox listBox = new ListBox();

            listBox.Margin = new Thickness(2);
            //GongSolutions.Wpf.DragDrop.DragDrop.SetDragHandler();
            GongSolutions.Wpf.DragDrop.DragDrop.SetIsDragSource(listBox, true);
            GongSolutions.Wpf.DragDrop.DragDrop.SetIsDropTarget(listBox, true);
            GongSolutions.Wpf.DragDrop.DragDrop.SetDropTargetAdornerBrush(listBox, new SolidColorBrush(Colors.Coral));
            metroTabItem.Content = listBox;

            this.tab_linkCard.Items.Add(metroTabItem);
        }
コード例 #24
0
        public void AddSelectedCategory(MetroTabControl tabControl)
        {
            tabControl.Items.Clear();
            for (int i = 0; i < SelectedCategorySource.Rows.Count; i++)
            {
                MetroTabItem item = new MetroTabItem()
                {
                    CloseButtonEnabled = true,
                    Header             = SelectedCategorySource.Rows[i]["categoryname"].ToString(),
                    Tag             = SelectedCategorySource.Rows[i]["id"].ToString(),
                    Padding         = new Thickness(20, 3, 20, 3),
                    BorderThickness = new Thickness(1),
                    BorderBrush     = new SolidColorBrush(Colors.DeepSkyBlue),
                };
                ControlsHelper.SetHeaderFontSize(item, 14.0);

                tabControl.Items.Add(item);
            }
        }
コード例 #25
0
        public CreaturePanel()
        {
            InitializeComponent();
            for (int i = 0; i < 8; i++)
            {
                _editors[i] = new CreatureEditor(i);
                var tabCreature = new MetroTabItem();
                tabCreature.Name    = "Creature" + i;
                tabCreature.Header  = "Creature " + i;
                tabCreature.Content = _editors[i];
                ControlsHelper.SetHeaderFontSize(tabCreature, 12);
                TabCreatures.Items.Add(tabCreature);
            }

            TabCreatures.Items.Add(new Button()
            {
                Content = "Test"
            });
            UpdateCreaturesMethod();
            UpdateCreatures += UpdateCreaturesMethod;
        }
コード例 #26
0
ファイル: MetroShellEx.cs プロジェクト: hklang/JJStart
        /// <summary>
        /// 重写方法,添加文本框
        /// </summary>
        /// <param name="objItem"></param>
        /// <param name="e"></param>
        protected override void OnSelectedTabChanged(EventArgs e)
        {
            //如果没有输入任何字符串
            if (this._NameEdit.Text.Trim() != "" && this._NameEdit.Modified)
            {
                //显示修改后的
                this._MetroTabItemLastShow.Text = this._NameEdit.Text;
            }

            //隐藏
            this._NameEdit.Hide();

            //新的
            this._MetroTabItem = this.SelectedTab;

            //先取消在注册
            this._MetroTabItem.DoubleClick -= _MetroTabItem_DoubleClick;
            this._MetroTabItem.DoubleClick += _MetroTabItem_DoubleClick;
            this._MetroTabItem.MouseDown   += _MetroTabItem_MouseDown;

            //基类方法
            base.OnSelectedTabChanged(e);
        }
コード例 #27
0
        private IChatControl GetOrCreateTab(string name)
        {
            try
            {
                var privateTalk = PrivateTalks.SingleOrDefault(t => ((t.Tag as TabItem)?.Header as PrivateTalkTabHeader)?.TabName.ToString() == name);
                if (privateTalk != null)
                {
                    return(privateTalk);
                }
                privateTalk = new PanelChatControl();

                //if (_histories.ContainsKey(name))
                //    GetTextFromRichTextBox(privateTalk.ChatRichTextBox).Text = _histories[name];

                privateTalk.UserTryingToSendMessage += async arr =>
                {
                    try
                    {
                        if (arr == null || arr.Length == 0)
                        {
                            return;
                        }
                        await Server.SendToPersonalChatAsync(UserName, name, arr);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.ToString());
                    }
                };

                var header = new PrivateTalkTabHeader {
                    TabName = name
                };
                var tabItem = new MetroTabItem {
                    Header = header, Content = privateTalk
                };
                header.CloseButtonPressed += () =>
                {
                    try
                    {
                        //var text = GetTextFromRichTextBox(privateTalk.ChatRichTextBox).Text;
                        //_histories.AddOrUpdate(name, text, (oldT, newT) => newT);

                        PrivateTalks.Remove(privateTalk);
                        TalksTabControl.Items.Remove(tabItem);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.ToString());
                    }
                };

                privateTalk.Tag = tabItem;
                PrivateTalks.Add(privateTalk);
                TalksTabControl.Items.Add(tabItem);
                return(privateTalk);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            return(null);
        }
コード例 #28
0
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
     this.styleManager      = new DevComponents.DotNetBar.StyleManager(this.components);
     this.comboItem31       = new DevComponents.Editors.ComboItem();
     this.comboItem14       = new DevComponents.Editors.ComboItem();
     this.comboItem15       = new DevComponents.Editors.ComboItem();
     this.comboItem16       = new DevComponents.Editors.ComboItem();
     this.comboItem17       = new DevComponents.Editors.ComboItem();
     this.comboItem18       = new DevComponents.Editors.ComboItem();
     this.comboItem19       = new DevComponents.Editors.ComboItem();
     this.comboItem20       = new DevComponents.Editors.ComboItem();
     this.comboItem21       = new DevComponents.Editors.ComboItem();
     this.comboItem22       = new DevComponents.Editors.ComboItem();
     this.comboItem23       = new DevComponents.Editors.ComboItem();
     this.comboItem24       = new DevComponents.Editors.ComboItem();
     this.comboItem25       = new DevComponents.Editors.ComboItem();
     this.comboItem26       = new DevComponents.Editors.ComboItem();
     this.comboItem27       = new DevComponents.Editors.ComboItem();
     this.comboItem28       = new DevComponents.Editors.ComboItem();
     this.comboItem29       = new DevComponents.Editors.ComboItem();
     this.comboItem30       = new DevComponents.Editors.ComboItem();
     this.comboItem32       = new DevComponents.Editors.ComboItem();
     this.comboItem33       = new DevComponents.Editors.ComboItem();
     this.comboItem34       = new DevComponents.Editors.ComboItem();
     this.comboItem35       = new DevComponents.Editors.ComboItem();
     this.comboItem36       = new DevComponents.Editors.ComboItem();
     this.comboItem37       = new DevComponents.Editors.ComboItem();
     this.comboItem38       = new DevComponents.Editors.ComboItem();
     this.comboItem39       = new DevComponents.Editors.ComboItem();
     this.comboItem40       = new DevComponents.Editors.ComboItem();
     this.comboItem41       = new DevComponents.Editors.ComboItem();
     this.comboItem42       = new DevComponents.Editors.ComboItem();
     this.comboItem43       = new DevComponents.Editors.ComboItem();
     this.comboItem44       = new DevComponents.Editors.ComboItem();
     this.comboItem45       = new DevComponents.Editors.ComboItem();
     this.comboItem46       = new DevComponents.Editors.ComboItem();
     this.comboItem47       = new DevComponents.Editors.ComboItem();
     this.comboItem48       = new DevComponents.Editors.ComboItem();
     this.comboItem49       = new DevComponents.Editors.ComboItem();
     this.comboItem50       = new DevComponents.Editors.ComboItem();
     this.comboItem51       = new DevComponents.Editors.ComboItem();
     this.comboItem52       = new DevComponents.Editors.ComboItem();
     this.comboItem53       = new DevComponents.Editors.ComboItem();
     this.comboItem54       = new DevComponents.Editors.ComboItem();
     this.comboItem55       = new DevComponents.Editors.ComboItem();
     this.comboItem1        = new DevComponents.Editors.ComboItem();
     this.comboItem2        = new DevComponents.Editors.ComboItem();
     this.comboItem3        = new DevComponents.Editors.ComboItem();
     this.comboItem4        = new DevComponents.Editors.ComboItem();
     this.comboItem5        = new DevComponents.Editors.ComboItem();
     this.comboItem6        = new DevComponents.Editors.ComboItem();
     this.comboItem7        = new DevComponents.Editors.ComboItem();
     this.comboItem8        = new DevComponents.Editors.ComboItem();
     this.comboItem9        = new DevComponents.Editors.ComboItem();
     this.comboItem10       = new DevComponents.Editors.ComboItem();
     this.comboItem11       = new DevComponents.Editors.ComboItem();
     this.comboItem12       = new DevComponents.Editors.ComboItem();
     this.comboItem13       = new DevComponents.Editors.ComboItem();
     this.metroShell1       = new DevComponents.DotNetBar.Metro.MetroShell();
     this.metroShell2       = new DevComponents.DotNetBar.Metro.MetroShell();
     this.metroTabPanel1    = new DevComponents.DotNetBar.Metro.MetroTabPanel();
     this.lnbHelp           = new System.Windows.Forms.LinkLabel();
     this.labelX1           = new DevComponents.DotNetBar.LabelX();
     this.lbCredibility     = new DevComponents.DotNetBar.LabelX();
     this.lbName            = new DevComponents.DotNetBar.LabelX();
     this.btnRegister       = new DevComponents.DotNetBar.ButtonX();
     this.btnLogin          = new DevComponents.DotNetBar.ButtonX();
     this.tbPasswd          = new DevComponents.DotNetBar.Controls.TextBoxX();
     this.tbUser            = new DevComponents.DotNetBar.Controls.TextBoxX();
     this.lbPassword        = new DevComponents.DotNetBar.LabelX();
     this.lbuser            = new DevComponents.DotNetBar.LabelX();
     this.metroTabItem1     = new DevComponents.DotNetBar.Metro.MetroTabItem();
     this.metroStatusBar1   = new DevComponents.DotNetBar.Metro.MetroStatusBar();
     this.labelItem1        = new DevComponents.DotNetBar.LabelItem();
     this.lbItemTime        = new DevComponents.DotNetBar.LabelItem();
     this.lbItemSpanTime    = new DevComponents.DotNetBar.LabelItem();
     this.btnItemDonate     = new DevComponents.DotNetBar.ButtonItem();
     this.notifyIcon1       = new System.Windows.Forms.NotifyIcon(this.components);
     this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
     this.mstripShow        = new System.Windows.Forms.ToolStripMenuItem();
     this.mstripExit        = new System.Windows.Forms.ToolStripMenuItem();
     this.registerControl   = new WindowsForm.RegisterControl();
     this.metroShell2.SuspendLayout();
     this.metroTabPanel1.SuspendLayout();
     this.contextMenuStrip1.SuspendLayout();
     this.SuspendLayout();
     //
     // styleManager
     //
     this.styleManager.ManagerColorTint     = System.Drawing.Color.White;
     this.styleManager.ManagerStyle         = DevComponents.DotNetBar.eStyle.OfficeMobile2014;
     this.styleManager.MetroColorParameters = new DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters(System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(254)))), ((int)(((byte)(254))))), System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(120)))), ((int)(((byte)(143))))));
     //
     // comboItem31
     //
     this.comboItem31.Text = "Default";
     //
     // comboItem14
     //
     this.comboItem14.Text = "VisualStudio2012Light";
     //
     // comboItem15
     //
     this.comboItem15.Text = "VisualStudio2012Dark";
     //
     // comboItem16
     //
     this.comboItem16.Text = "WashedWhite";
     //
     // comboItem17
     //
     this.comboItem17.Text = "WashedBlue";
     //
     // comboItem18
     //
     this.comboItem18.Text = "BlackClouds";
     //
     // comboItem19
     //
     this.comboItem19.Text = "BlackLilac";
     //
     // comboItem20
     //
     this.comboItem20.Text = "BlackMaroon";
     //
     // comboItem21
     //
     this.comboItem21.Text = "BlackSky";
     //
     // comboItem22
     //
     this.comboItem22.Text = "Blue";
     //
     // comboItem23
     //
     this.comboItem23.Text = "BlueishBrown";
     //
     // comboItem24
     //
     this.comboItem24.Text = "Bordeaux";
     //
     // comboItem25
     //
     this.comboItem25.Text = "Brown";
     //
     // comboItem26
     //
     this.comboItem26.Text = "Cherry";
     //
     // comboItem27
     //
     this.comboItem27.Text = "DarkBlue";
     //
     // comboItem28
     //
     this.comboItem28.Text = "DarkBrown";
     //
     // comboItem29
     //
     this.comboItem29.Text = "DarkPurple";
     //
     // comboItem30
     //
     this.comboItem30.Text = "DarkRed";
     //
     // comboItem32
     //
     this.comboItem32.Text = "EarlyMaroon";
     //
     // comboItem33
     //
     this.comboItem33.Text = "EarlyOrange";
     //
     // comboItem34
     //
     this.comboItem34.Text = "EarlyRed";
     //
     // comboItem35
     //
     this.comboItem35.Text = "Espresso";
     //
     // comboItem36
     //
     this.comboItem36.Text = "ForestGreen";
     //
     // comboItem37
     //
     this.comboItem37.Text = "GrayOrange";
     //
     // comboItem38
     //
     this.comboItem38.Text = "Green";
     //
     // comboItem39
     //
     this.comboItem39.Text = "Latte";
     //
     // comboItem40
     //
     this.comboItem40.Text = "LatteDarkSteel";
     //
     // comboItem41
     //
     this.comboItem41.Text = "LatteRed";
     //
     // comboItem42
     //
     this.comboItem42.Text = "Magenta";
     //
     // comboItem43
     //
     this.comboItem43.Text = "MaroonSilver";
     //
     // comboItem44
     //
     this.comboItem44.Text = "NapaRed";
     //
     // comboItem45
     //
     this.comboItem45.Text = "Orange";
     //
     // comboItem46
     //
     this.comboItem46.Text = "PowderRed";
     //
     // comboItem47
     //
     this.comboItem47.Text = "Purple";
     //
     // comboItem48
     //
     this.comboItem48.Text = "Red";
     //
     // comboItem49
     //
     this.comboItem49.Text = "RedAmplified";
     //
     // comboItem50
     //
     this.comboItem50.Text = "RetroBlue";
     //
     // comboItem51
     //
     this.comboItem51.Text = "Rust";
     //
     // comboItem52
     //
     this.comboItem52.Text = "SilverBlues";
     //
     // comboItem53
     //
     this.comboItem53.Text = "SilverGreen";
     //
     // comboItem54
     //
     this.comboItem54.Text = "SimplyBlue";
     //
     // comboItem55
     //
     this.comboItem55.Text = "SkyGreen";
     //
     // comboItem1
     //
     this.comboItem1.Text = "Office2007Blue";
     //
     // comboItem2
     //
     this.comboItem2.Text = "Office2007Silver";
     //
     // comboItem3
     //
     this.comboItem3.Text = "Office2007Black";
     //
     // comboItem4
     //
     this.comboItem4.Text = "Office2007VistaGlass";
     //
     // comboItem5
     //
     this.comboItem5.Text = "Office2010Silver";
     //
     // comboItem6
     //
     this.comboItem6.Text = "Office2010Blue";
     //
     // comboItem7
     //
     this.comboItem7.Text = "Office2010Black";
     //
     // comboItem8
     //
     this.comboItem8.Text = "Windows7Blue";
     //
     // comboItem9
     //
     this.comboItem9.Text = "VisualStudio2010Blue";
     //
     // comboItem10
     //
     this.comboItem10.Text = "Office2013";
     //
     // comboItem11
     //
     this.comboItem11.Text = "VisualStudio2012Light";
     //
     // comboItem12
     //
     this.comboItem12.Text = "VisualStudio2012Dark";
     //
     // comboItem13
     //
     this.comboItem13.Text = "OfficeMobile2014";
     //
     // metroShell1
     //
     this.metroShell1.BackColor = System.Drawing.Color.White;
     //
     //
     //
     this.metroShell1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.metroShell1.ForeColor      = System.Drawing.Color.Black;
     this.metroShell1.HelpButtonText = null;
     this.metroShell1.Location       = new System.Drawing.Point(0, 0);
     this.metroShell1.Name           = "metroShell1";
     this.metroShell1.Size           = new System.Drawing.Size(200, 100);
     this.metroShell1.SystemText.MaximizeRibbonText         = "&Maximize the Ribbon";
     this.metroShell1.SystemText.MinimizeRibbonText         = "Mi&nimize the Ribbon";
     this.metroShell1.SystemText.QatAddItemText             = "&Add to Quick Access Toolbar";
     this.metroShell1.SystemText.QatCustomizeMenuLabel      = "<b>Customize Quick Access Toolbar</b>";
     this.metroShell1.SystemText.QatCustomizeText           = "&Customize Quick Access Toolbar...";
     this.metroShell1.SystemText.QatDialogAddButton         = "&Add >>";
     this.metroShell1.SystemText.QatDialogCancelButton      = "Cancel";
     this.metroShell1.SystemText.QatDialogCaption           = "Customize Quick Access Toolbar";
     this.metroShell1.SystemText.QatDialogCategoriesLabel   = "&Choose commands from:";
     this.metroShell1.SystemText.QatDialogOkButton          = "OK";
     this.metroShell1.SystemText.QatDialogPlacementCheckbox = "&Place Quick Access Toolbar below the Ribbon";
     this.metroShell1.SystemText.QatDialogRemoveButton      = "&Remove";
     this.metroShell1.SystemText.QatPlaceAboveRibbonText    = "&Place Quick Access Toolbar above the Ribbon";
     this.metroShell1.SystemText.QatPlaceBelowRibbonText    = "&Place Quick Access Toolbar below the Ribbon";
     this.metroShell1.SystemText.QatRemoveItemText          = "&Remove from Quick Access Toolbar";
     this.metroShell1.TabIndex     = 0;
     this.metroShell1.TabStripFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
     //
     // metroShell2
     //
     this.metroShell2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(254)))), ((int)(((byte)(254)))));
     //
     //
     //
     this.metroShell2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.metroShell2.CaptionVisible             = true;
     this.metroShell2.Controls.Add(this.metroTabPanel1);
     this.metroShell2.Dock           = System.Windows.Forms.DockStyle.Top;
     this.metroShell2.Font           = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
     this.metroShell2.ForeColor      = System.Drawing.Color.Black;
     this.metroShell2.HelpButtonText = "关于";
     this.metroShell2.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
         this.metroTabItem1
     });
     this.metroShell2.KeyTipsFont = new System.Drawing.Font("Tahoma", 7F);
     this.metroShell2.Location    = new System.Drawing.Point(1, 1);
     this.metroShell2.Margin      = new System.Windows.Forms.Padding(2);
     this.metroShell2.MouseWheelTabScrollEnabled = false;
     this.metroShell2.Name = "metroShell2";
     this.metroShell2.SettingsButtonText = "设置";
     this.metroShell2.Size = new System.Drawing.Size(1034, 132);
     this.metroShell2.SystemText.MaximizeRibbonText         = "&Maximize the Ribbon";
     this.metroShell2.SystemText.MinimizeRibbonText         = "Mi&nimize the Ribbon";
     this.metroShell2.SystemText.QatAddItemText             = "&Add to Quick Access Toolbar";
     this.metroShell2.SystemText.QatCustomizeMenuLabel      = "<b>Customize Quick Access Toolbar</b>";
     this.metroShell2.SystemText.QatCustomizeText           = "&Customize Quick Access Toolbar...";
     this.metroShell2.SystemText.QatDialogAddButton         = "&Add >>";
     this.metroShell2.SystemText.QatDialogCancelButton      = "Cancel";
     this.metroShell2.SystemText.QatDialogCaption           = "Customize Quick Access Toolbar";
     this.metroShell2.SystemText.QatDialogCategoriesLabel   = "&Choose commands from:";
     this.metroShell2.SystemText.QatDialogOkButton          = "OK";
     this.metroShell2.SystemText.QatDialogPlacementCheckbox = "&Place Quick Access Toolbar below the Ribbon";
     this.metroShell2.SystemText.QatDialogRemoveButton      = "&Remove";
     this.metroShell2.SystemText.QatPlaceAboveRibbonText    = "&Place Quick Access Toolbar above the Ribbon";
     this.metroShell2.SystemText.QatPlaceBelowRibbonText    = "&Place Quick Access Toolbar below the Ribbon";
     this.metroShell2.SystemText.QatRemoveItemText          = "&Remove from Quick Access Toolbar";
     this.metroShell2.TabIndex             = 0;
     this.metroShell2.TabStripFont         = new System.Drawing.Font("Segoe UI", 10.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.metroShell2.Text                 = "metroShell2";
     this.metroShell2.UseCustomizeDialog   = false;
     this.metroShell2.SettingsButtonClick += new System.EventHandler(this.metroShell2_SettingsButtonClick);
     this.metroShell2.HelpButtonClick     += new System.EventHandler(this.metroShell2_HelpButtonClick);
     this.metroShell2.SizeChanged         += new System.EventHandler(this.metroShell2_SizeChanged);
     //
     // metroTabPanel1
     //
     this.metroTabPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
     this.metroTabPanel1.Controls.Add(this.lnbHelp);
     this.metroTabPanel1.Controls.Add(this.labelX1);
     this.metroTabPanel1.Controls.Add(this.lbCredibility);
     this.metroTabPanel1.Controls.Add(this.lbName);
     this.metroTabPanel1.Controls.Add(this.btnRegister);
     this.metroTabPanel1.Controls.Add(this.btnLogin);
     this.metroTabPanel1.Controls.Add(this.tbPasswd);
     this.metroTabPanel1.Controls.Add(this.tbUser);
     this.metroTabPanel1.Controls.Add(this.lbPassword);
     this.metroTabPanel1.Controls.Add(this.lbuser);
     this.metroTabPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.metroTabPanel1.Location = new System.Drawing.Point(0, 63);
     this.metroTabPanel1.Margin   = new System.Windows.Forms.Padding(2);
     this.metroTabPanel1.Name     = "metroTabPanel1";
     this.metroTabPanel1.Padding  = new System.Windows.Forms.Padding(2, 0, 2, 2);
     this.metroTabPanel1.Size     = new System.Drawing.Size(1034, 69);
     //
     //
     //
     this.metroTabPanel1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     //
     //
     //
     this.metroTabPanel1.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     //
     //
     //
     this.metroTabPanel1.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.metroTabPanel1.TabIndex = 1;
     //
     // lnbHelp
     //
     this.lnbHelp.AutoSize  = true;
     this.lnbHelp.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(254)))), ((int)(((byte)(254)))));
     this.lnbHelp.ForeColor = System.Drawing.Color.Black;
     this.lnbHelp.Location  = new System.Drawing.Point(360, 44);
     this.lnbHelp.Name      = "lnbHelp";
     this.lnbHelp.Size      = new System.Drawing.Size(119, 14);
     this.lnbHelp.TabIndex  = 9;
     this.lnbHelp.TabStop   = true;
     this.lnbHelp.Text      = "信誉度等常见问题";
     this.lnbHelp.Click    += new System.EventHandler(this.lnbHelp_Click);
     //
     // labelX1
     //
     this.labelX1.BackColor = System.Drawing.Color.Transparent;
     //
     //
     //
     this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.labelX1.ForeColor = System.Drawing.Color.Black;
     this.labelX1.Location  = new System.Drawing.Point(360, 13);
     this.labelX1.Name      = "labelX1";
     this.labelX1.Size      = new System.Drawing.Size(583, 23);
     this.labelX1.TabIndex  = 8;
     this.labelX1.Text      = "声明:本软件使用过程中不记录用户名和密码,同时也不以任何形式保存用户名和密码。";
     //
     // lbCredibility
     //
     this.lbCredibility.BackColor = System.Drawing.Color.Transparent;
     //
     //
     //
     this.lbCredibility.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.lbCredibility.ForeColor = System.Drawing.Color.Black;
     this.lbCredibility.Location  = new System.Drawing.Point(132, 39);
     this.lbCredibility.Name      = "lbCredibility";
     this.lbCredibility.Size      = new System.Drawing.Size(111, 23);
     this.lbCredibility.TabIndex  = 7;
     this.lbCredibility.Visible   = false;
     //
     // lbName
     //
     this.lbName.BackColor = System.Drawing.Color.Transparent;
     //
     //
     //
     this.lbName.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.lbName.ForeColor = System.Drawing.Color.Black;
     this.lbName.Location  = new System.Drawing.Point(132, 11);
     this.lbName.Name      = "lbName";
     this.lbName.Size      = new System.Drawing.Size(111, 23);
     this.lbName.TabIndex  = 6;
     this.lbName.Visible   = false;
     //
     // btnRegister
     //
     this.btnRegister.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
     this.btnRegister.ColorTable     = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
     this.btnRegister.Location       = new System.Drawing.Point(254, 41);
     this.btnRegister.Name           = "btnRegister";
     this.btnRegister.Size           = new System.Drawing.Size(75, 23);
     this.btnRegister.Style          = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
     this.btnRegister.TabIndex       = 5;
     this.btnRegister.Text           = "免费注册";
     this.btnRegister.Click         += new System.EventHandler(this.btnRegister_Click);
     //
     // btnLogin
     //
     this.btnLogin.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
     this.btnLogin.ColorTable     = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
     this.btnLogin.Location       = new System.Drawing.Point(254, 10);
     this.btnLogin.Name           = "btnLogin";
     this.btnLogin.Size           = new System.Drawing.Size(75, 23);
     this.btnLogin.Style          = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
     this.btnLogin.TabIndex       = 4;
     this.btnLogin.Text           = "登陆";
     this.btnLogin.Click         += new System.EventHandler(this.btnLogin_Click);
     //
     // tbPasswd
     //
     this.tbPasswd.BackColor = System.Drawing.Color.White;
     //
     //
     //
     this.tbPasswd.Border.Class      = "TextBoxBorder";
     this.tbPasswd.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.tbPasswd.DisabledBackColor = System.Drawing.Color.White;
     this.tbPasswd.ForeColor         = System.Drawing.Color.Black;
     this.tbPasswd.Location          = new System.Drawing.Point(86, 40);
     this.tbPasswd.Name             = "tbPasswd";
     this.tbPasswd.PasswordChar     = '*';
     this.tbPasswd.PreventEnterBeep = true;
     this.tbPasswd.Size             = new System.Drawing.Size(151, 23);
     this.tbPasswd.TabIndex         = 3;
     //
     // tbUser
     //
     this.tbUser.BackColor = System.Drawing.Color.White;
     //
     //
     //
     this.tbUser.Border.Class      = "TextBoxBorder";
     this.tbUser.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.tbUser.DisabledBackColor = System.Drawing.Color.White;
     this.tbUser.ForeColor         = System.Drawing.Color.Black;
     this.tbUser.Location          = new System.Drawing.Point(86, 10);
     this.tbUser.Name             = "tbUser";
     this.tbUser.PreventEnterBeep = true;
     this.tbUser.Size             = new System.Drawing.Size(151, 23);
     this.tbUser.TabIndex         = 2;
     this.tbUser.WatermarkText    = "请输入身份证";
     //
     // lbPassword
     //
     this.lbPassword.BackColor = System.Drawing.Color.Transparent;
     //
     //
     //
     this.lbPassword.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.lbPassword.ForeColor = System.Drawing.Color.Black;
     this.lbPassword.Location  = new System.Drawing.Point(21, 40);
     this.lbPassword.Name      = "lbPassword";
     this.lbPassword.Size      = new System.Drawing.Size(59, 23);
     this.lbPassword.TabIndex  = 1;
     this.lbPassword.Text      = "密 码";
     //
     // lbuser
     //
     this.lbuser.BackColor = System.Drawing.Color.Transparent;
     //
     //
     //
     this.lbuser.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
     this.lbuser.ForeColor = System.Drawing.Color.Black;
     this.lbuser.Location  = new System.Drawing.Point(21, 10);
     this.lbuser.Name      = "lbuser";
     this.lbuser.Size      = new System.Drawing.Size(59, 23);
     this.lbuser.TabIndex  = 0;
     this.lbuser.Text      = "账户名";
     //
     // metroTabItem1
     //
     this.metroTabItem1.Checked = true;
     this.metroTabItem1.Name    = "metroTabItem1";
     this.metroTabItem1.Panel   = this.metroTabPanel1;
     this.metroTabItem1.Text    = "个人中心";
     //
     // metroStatusBar1
     //
     this.metroStatusBar1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(254)))), ((int)(((byte)(254)))));
     //
     //
     //
     this.metroStatusBar1.BackgroundStyle.CornerType       = DevComponents.DotNetBar.eCornerType.Square;
     this.metroStatusBar1.ContainerControlProcessDialogKey = true;
     this.metroStatusBar1.Dock            = System.Windows.Forms.DockStyle.Bottom;
     this.metroStatusBar1.DragDropSupport = true;
     this.metroStatusBar1.Font            = new System.Drawing.Font("Segoe UI", 10.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.metroStatusBar1.ForeColor       = System.Drawing.Color.Black;
     this.metroStatusBar1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
         this.labelItem1,
         this.lbItemTime,
         this.lbItemSpanTime,
         this.btnItemDonate
     });
     this.metroStatusBar1.Location = new System.Drawing.Point(1, 642);
     this.metroStatusBar1.Margin   = new System.Windows.Forms.Padding(2);
     this.metroStatusBar1.Name     = "metroStatusBar1";
     this.metroStatusBar1.Size     = new System.Drawing.Size(1034, 32);
     this.metroStatusBar1.TabIndex = 1;
     this.metroStatusBar1.Text     = "metroStatusBar1";
     //
     // labelItem1
     //
     this.labelItem1.Name = "labelItem1";
     this.labelItem1.Text = "北京时间:";
     //
     // lbItemTime
     //
     this.lbItemTime.Cursor = System.Windows.Forms.Cursors.Hand;
     this.lbItemTime.Name   = "lbItemTime";
     this.lbItemTime.Text   = "网络连接失败";
     this.lbItemTime.Click += new System.EventHandler(this.lbItemTime_Click);
     //
     // lbItemSpanTime
     //
     this.lbItemSpanTime.Name = "lbItemSpanTime";
     //
     // btnItemDonate
     //
     this.btnItemDonate.ItemAlignment = DevComponents.DotNetBar.eItemAlignment.Far;
     this.btnItemDonate.Name          = "btnItemDonate";
     this.btnItemDonate.Text          = "捐助软件";
     this.btnItemDonate.Click        += new System.EventHandler(this.btnItemDonate_Click);
     //
     // notifyIcon1
     //
     this.notifyIcon1.ContextMenuStrip  = this.contextMenuStrip1;
     this.notifyIcon1.Icon              = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
     this.notifyIcon1.Text              = "杭州预约挂号辅助软件";
     this.notifyIcon1.Visible           = true;
     this.notifyIcon1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick);
     //
     // contextMenuStrip1
     //
     this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.mstripShow,
         this.mstripExit
     });
     this.contextMenuStrip1.Name = "contextMenuStrip1";
     this.contextMenuStrip1.Size = new System.Drawing.Size(137, 48);
     //
     // mstripShow
     //
     this.mstripShow.Name   = "mstripShow";
     this.mstripShow.Size   = new System.Drawing.Size(136, 22);
     this.mstripShow.Text   = "打开主程序";
     this.mstripShow.Click += new System.EventHandler(this.mstripShow_Click);
     //
     // mstripExit
     //
     this.mstripExit.Name   = "mstripExit";
     this.mstripExit.Size   = new System.Drawing.Size(136, 22);
     this.mstripExit.Text   = "退出";
     this.mstripExit.Click += new System.EventHandler(this.mstripExit_Click);
     //
     // registerControl
     //
     this.registerControl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(254)))), ((int)(((byte)(254)))));
     this.registerControl.Dock      = System.Windows.Forms.DockStyle.Fill;
     this.registerControl.ForeColor = System.Drawing.Color.Black;
     this.registerControl.Location  = new System.Drawing.Point(1, 133);
     this.registerControl.Name      = "registerControl";
     this.registerControl.Size      = new System.Drawing.Size(1034, 509);
     this.registerControl.TabIndex  = 2;
     //
     // MainForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(1036, 675);
     this.Controls.Add(this.registerControl);
     this.Controls.Add(this.metroStatusBar1);
     this.Controls.Add(this.metroShell2);
     this.DoubleBuffered     = true;
     this.Font               = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
     this.Icon               = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Margin             = new System.Windows.Forms.Padding(2);
     this.Name               = "MainForm";
     this.StartPosition      = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.SystemMenuClose    = "关闭";
     this.SystemMenuMaximize = "最大化";
     this.SystemMenuMinimize = "最小化";
     this.SystemMenuMove     = "移动";
     this.SystemMenuRestore  = "还原";
     this.SystemMenuSize     = "大小";
     this.Text               = "杭州预约挂号辅助软件";
     this.metroShell2.ResumeLayout(false);
     this.metroShell2.PerformLayout();
     this.metroTabPanel1.ResumeLayout(false);
     this.metroTabPanel1.PerformLayout();
     this.contextMenuStrip1.ResumeLayout(false);
     this.ResumeLayout(false);
 }
コード例 #29
0
        private async void ImportExcel(string filePath, string fileName)
        {
            var controller = await this.ShowProgressAsync("Importing", "Please wait...");

            controller.SetIndeterminate();

            Microsoft.Office.Interop.Excel.Application application = new Microsoft.Office.Interop.Excel.Application();
            Microsoft.Office.Interop.Excel.Workbook    workbook    = application.Workbooks.Open(filePath);
            Microsoft.Office.Interop.Excel.Worksheet   worksheet   = workbook.Sheets[1];
            Microsoft.Office.Interop.Excel.Range       range       = worksheet.UsedRange;

            int rowCount    = range.Rows.Count;
            int columnCount = range.Columns.Count;

            var pcList = new List <Pc>();
            await Task.Run(() =>
            {
                for (int i = 2; i <= rowCount; i++)
                {
                    var listResultString = new List <string>();
                    for (int j = 1; j <= columnCount; j++)
                    {
                        if (range.Cells[i, j] != null && range.Cells[i, j].Value != null)
                        {
                            listResultString.Add(range.Cells[i, j].Value.ToString());
                        }
                        else
                        {
                            listResultString.Add("");
                        }
                    }

                    pcList.Add(new Pc
                    {
                        PC_Name        = listResultString[0] == "" ? null : listResultString[0],
                        Type           = listResultString[1] == "" ? null : listResultString[1],
                        HDD            = listResultString[2] == "" ? null : listResultString[2],
                        CPU            = listResultString[3] == "" ? null : listResultString[3],
                        RAM            = listResultString[4] == "" ? null : listResultString[4],
                        OS             = listResultString[5] == "" ? null : listResultString[5],
                        IP             = listResultString[6] == "" ? null : listResultString[6],
                        MAC            = listResultString[7] == "" ? null : listResultString[7],
                        MAC2           = listResultString[8] == "" ? null : listResultString[8],
                        NV             = listResultString[9] == "" ? null : listResultString[9],
                        NVCode         = listResultString[10] == "" ? null : listResultString[10],
                        PB             = listResultString[11] == "" ? null : listResultString[11],
                        Office_Located = listResultString[12] == "" ? null : listResultString[12],
                        ServiceTag     = listResultString[13] == "" ? null : listResultString[13],
                        Model          = listResultString[14] == "" ? null : listResultString[14],
                        Mouse          = listResultString[15] == "" ? null : listResultString[15],
                        KeyBoard       = listResultString[16] == "" ? null : listResultString[16],
                        Notes          = listResultString[17] == "" ? null : listResultString[17],
                    });
                }

                //cleanup
                GC.Collect();
                GC.WaitForPendingFinalizers();

                //release com objects to fully kill excel process from running in the background
                Marshal.ReleaseComObject(range);
                Marshal.ReleaseComObject(worksheet);

                //close and release
                workbook.Close();
                Marshal.ReleaseComObject(workbook);

                //quit and release
                application.Quit();
                Marshal.ReleaseComObject(application);
            });



            MetroTabItem item = new MetroTabItem
            {
                Header             = fileName,
                CloseButtonEnabled = true,
            };
            ImportExcel view = new Views.ImportExcel(pcList);

            item.Content = view;

            await controller.CloseAsync();

            MainTabControl.Items.Add(item);
            item.Focus();
        }
コード例 #30
0
        private Rectangle GetTextRectangle(MetroTabItem tab, CompositeImage image, Rectangle imageBounds)
        {
            Rectangle itemRect = tab.DisplayRectangle;
            Rectangle textRect = tab.TextDrawRect;

            if (tab.ImagePosition == eImagePosition.Top || tab.ImagePosition == eImagePosition.Bottom)
            {
                textRect = new Rectangle(1, textRect.Y, itemRect.Width - 2, textRect.Height);
            }
            textRect.Offset(itemRect.Left, itemRect.Top);

            if (tab.ImagePosition == eImagePosition.Left)
                textRect.X = imageBounds.Right + tab.ImagePaddingHorizontal;

            if (textRect.Right > itemRect.Right)
                textRect.Width = itemRect.Right - textRect.Left;

            return textRect;
        }
コード例 #31
0
        private Rectangle GetImageRectangle(MetroTabItem tab, CompositeImage image)
        {
            Rectangle imageRect = Rectangle.Empty;
            // Calculate image position
            if (image != null)
            {
                Size imageSize = tab.ImageSize;

                if (tab.ImagePosition == eImagePosition.Top || tab.ImagePosition == eImagePosition.Bottom)
                    imageRect = new Rectangle(tab.ImageDrawRect.X, tab.ImageDrawRect.Y, tab.DisplayRectangle.Width, tab.ImageDrawRect.Height);
                else if(tab.ImagePosition == eImagePosition.Left)
                    imageRect = new Rectangle(tab.ImageDrawRect.X+4, tab.ImageDrawRect.Y, tab.ImageDrawRect.Width, tab.ImageDrawRect.Height);
                else if (tab.ImagePosition == eImagePosition.Right)
                    imageRect = new Rectangle(tab.ImageDrawRect.X + tab.ImagePaddingHorizontal+4, tab.ImageDrawRect.Y, tab.ImageDrawRect.Width, tab.ImageDrawRect.Height);
                imageRect.Offset(tab.DisplayRectangle.Left, tab.DisplayRectangle.Top);
                imageRect.Offset((imageRect.Width - imageSize.Width) / 2, (imageRect.Height - imageSize.Height) / 2);

                imageRect.Width = imageSize.Width;
                imageRect.Height = imageSize.Height;
            }

            return imageRect;
        }
コード例 #32
0
        private MetroTabItem CreateTab(NPCCharacter character)
        {
            var binding = new Binding()
            {
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.OneWay,
                Path = new PropertyPath("UIText")
            };
            Label l = new Label();

            l.SetBinding(Label.ContentProperty, binding);

            MetroTabItem tabItem = new MetroTabItem
            {
                CloseButtonEnabled = true,
                CloseTabCommand    = CloseTabCommand,
                Header             = l,
                DataContext        = character
            };

            tabItem.CloseTabCommandParameter = tabItem;

            var             cmenu      = new ContextMenu();
            List <MenuItem> cmenuItems = new List <MenuItem>()
            {
                ContextHelper.CreateCopyButton((object sender, RoutedEventArgs e) =>
                {
                    Save();

                    ContextMenu context = (sender as MenuItem).Parent as ContextMenu;
                    MetroTabItem target = context.PlacementTarget as MetroTabItem;
                    ClipboardManager.SetObject(Universal_ItemList.ReturnType.Character, target.DataContext);
                }),
                ContextHelper.CreateDuplicateButton((object sender, RoutedEventArgs e) =>
                {
                    Save();

                    ContextMenu context = (sender as MenuItem).Parent as ContextMenu;
                    MetroTabItem target = context.PlacementTarget as MetroTabItem;
                    var cloned          = (target.DataContext as NPCCharacter).Clone();

                    MainWindow.CurrentProject.data.characters.Add(cloned);
                    MetroTabItem ti = CreateTab(cloned);
                    MainWindow.Instance.characterTabSelect.Items.Add(ti);
                }),
                ContextHelper.CreatePasteButton((object sender, RoutedEventArgs e) =>
                {
                    if (ClipboardManager.TryGetObject(ClipboardManager.CharacterFormat, out var obj) && !(obj is null) && obj is NPCCharacter cloned)
                    {
                        MainWindow.CurrentProject.data.characters.Add(cloned);
                        MetroTabItem ti = CreateTab(cloned);
                        MainWindow.Instance.characterTabSelect.Items.Add(ti);
                    }
                })
            };

            foreach (var cmenuItem in cmenuItems)
            {
                cmenu.Items.Add(cmenuItem);
            }

            tabItem.ContextMenu = cmenu;

            return(tabItem);
        }
コード例 #33
0
 /// <summary>
 /// Renders the MetroTabItem.
 /// </summary>
 /// <param name="tab">Form to render.</param>
 /// <param name="e">Rendering event arguments.</param>
 public static void Paint(MetroTabItem tab, ItemPaintArgs pa)
 {
     MetroRenderer renderer = GetRenderer(Renderers.MetroTabItem);
     renderer.Render(GetRenderingInfo(tab, pa, GetColorTable()));
 }