/// <param name="parentPath">子菜单的父菜单的注册表路径</param>
            public ShellSubMenuForm(string parentPath)
            {
                this.ShowInTaskbar = false;
                this.StartPosition = FormStartPosition.CenterParent;
                this.MinimumSize   = this.Size = new Size(646, 389).DpiZoom();
                LstSubItems        = new MyListBox {
                    Dock = DockStyle.Fill, Parent = this
                };
                string value = GetValue(parentPath, "SubCommands", null)?.ToString();

                if (string.IsNullOrWhiteSpace(value))
                {
                    using (var shellKey = RegistryEx.GetRegistryKey($@"{parentPath}\shell"))
                    {
                        if (shellKey != null && shellKey.GetSubKeyNames().Length > 0)
                        {
                            new MultiItemsList(LstSubItems).LoadItems(parentPath);
                            return;
                        }
                        else
                        {
                            using (SubMenuModeForm frm = new SubMenuModeForm())
                            {
                                frm.ShowDialog();
                                if (frm.SubMenuMode == 1)
                                {
                                    new MultiItemsList(LstSubItems).LoadItems(parentPath);
                                    return;
                                }
                            }
                        }
                    }
                }
                new CommonMultiItemsList(LstSubItems).LoadItems(parentPath);
            }
 public PulicMultiItemsList(MyListBox owner) : base(owner)
 {
     this.AddItem(subNewItem);
     subNewItem.AddNewItem   += (sender, e) => AddNewItem();
     subNewItem.AddExisting  += (sender, e) => AddReference();
     subNewItem.AddSeparator += (sender, e) => AddSeparator();
 }
 public PrivateMultiItemsList(MyListBox owner) : base(owner)
 {
     this.AddItem(subNewItem);
     subNewItem.AddNewItem   += (sender, e) => AddNewItem();
     subNewItem.AddSeparator += (sender, e) => AddSeparator();
     subNewItem.AddExisting  += (sender, e) => AddFromParentMenu();
 }
 public MultiItemsList(MyListBox owner) : base(owner)
 {
     this.AddItem(newItem);
     newItem.AddCtr(btnAddCommon);
     newItem.NewItemAdd     += (sender, e) => AddNewItem();
     btnAddCommon.MouseDown += (sender, e) => AddCommonItems();
 }
Exemplo n.º 5
0
 public ListBoxHandler()
 {
     Control = new MyListBox();
     Control.SelectedIndexChanged += control_SelectedIndexChanged;
     Control.IntegralHeight        = false;
     Control.DoubleClick          += control_DoubleClick;
     Control.KeyDown += control_KeyDown;
 }
Exemplo n.º 6
0
        void ReplaceItemIntoSet_Click(object sender, EventArgs e)
        {
            MyListBox member_list = this.Parent.Controls[_member_list] as MyListBox;

            if (member_list != null)
            {
                member_list.ReplaceSelected();
            }
        }
Exemplo n.º 7
0
 void heavyProcessTimer_Tick(object sender, EventArgs e)
 {
     if (!threadProcess.IsAlive)
     {
         heavyProcessTimer.Stop();
         MyListBox.Focus();
         ShowResult(...);
     }
 }
Exemplo n.º 8
0
        void RemoveItemFromSet_Click(object sender, EventArgs e)
        {
            ListBox list = this.Parent.Controls[_group_list] as ListBox;

            if (list != null)
            {
                MyListBox.RemoveSelected(list);
            }
        }
Exemplo n.º 9
0
 public Locations()
 {
     InitializeComponent();
     M  = MyModel.GetInstance(Global.con);
     FM = new MyWinForm(this);
     FM.SetDefaultStyle("当前地点:" + M.GetLocationNameByID(INI.GetLocationID()));
     LB    = new MyListBox(listBox1, "select * from LabelLocations order by LocationOrder", "LocationName", "LocationID", Global.con, true);
     table = LB.DataTable;
     ToAdd();
 }
Exemplo n.º 10
0
 public Groups()
 {
     InitializeComponent();
     FM = new MyWinForm(this);
     FM.SetDefaultStyle("日记本");
     M     = MyModel.GetInstance(Global.con);
     LB    = new MyListBox(listBox1, "select * from DiaryGroups order by GroupOrder", "GroupName", "GroupID", Global.con, true);
     table = LB.DataTable;
     ToAdd();
 }
Exemplo n.º 11
0
 public Groups()
 {
     InitializeComponent();
     M     = MyModel.GetInstance(Global.con);
     FM    = new MyWinForm(this);
     LB    = new MyListBox(listBox1, "select * from LabelGroups where LocationID=" + LocationID + " order by GroupOrder", "GroupName", "GroupID", Global.con, true);
     table = LB.DataTable;
     FM.SetDefaultStyle("标签分组 >> 地点:" + M.GetLocationNameByID(LocationID));
     ToAdd();
 }
Exemplo n.º 12
0
    public static void Main()
    {
        MyListBox lbx = new MyListBox();

        lbx[0] = "foo";
        lbx[1] = "bar";
        lbx[2] = "baz";
        Console.WriteLine("{0} {1} {2}",
                          lbx[0], lbx[1], lbx[2]);
    }
Exemplo n.º 13
0
 void DefineView()
 {
     LBGroups = new MyListBox(listBox1, "select GroupID,GroupName from LabelGroups where LocationID=" + INI.GetLocationID() + " order by GroupOrder", "GroupName", "GroupID", Global.con);
     try { FirstGroupID = ((DataRowView)LBGroups.Items[0])["GroupID"].ToString(); }
     catch { FirstGroupID = "0"; }
     LBLabels = new MyListBox(listBox2, "select LabelName,Path from Labels where GroupID=" + FirstGroupID + " order by LabelOrder", "LabelName", "Path", Global.con);
     try { LBGroups.SelectedIndex = 0; }
     catch { }
     LBLabels.Focus();
 }
 public CommonMultiItemsList(MyListBox owner) : base(owner)
 {
     this.AddItem(newItem);
     newItem.AddCtrs(new[] { btnAddCommon, btnAddExisting, btnAddSeparator });
     MyToolTip.SetToolTip(btnAddExisting, AppString.Tip.AddExistingItems);
     MyToolTip.SetToolTip(btnAddSeparator, AppString.Tip.AddSeparator);
     newItem.NewItemAdd        += (sender, e) => AddNewItem();
     btnAddCommon.MouseDown    += (sender, e) => AddCommonItems();
     btnAddExisting.MouseDown  += (sender, e) => AddExistingItems();
     btnAddSeparator.MouseDown += (sender, e) => AddSeparator();
 }
Exemplo n.º 15
0
 protected override void OnLoad(EventArgs e)
 {
     mList          = new MyListBox(this);
     mList.Location = new Point(5, 10);
     mList.Size     = new Size(50, this.ClientSize.Height + 50);
     for (int ix = 0; ix < 100; ++ix)
     {
         mList.Items.Add(ix);
     }
     mList.SelectedIndexChanged += new EventHandler(mList_SelectedIndexChanged);
 }
Exemplo n.º 16
0
        private void MyListBox_OnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var lighties = MyListBox.SelectedItems;

            if (lighties.Count <= HueConnector.Lights.Count / 2)
            {
                MyListBox.SelectAll();
            }
            else
            {
                MyListBox.SelectedIndex = -1;
            }
        }
Exemplo n.º 17
0
 public void InitializeComponent()
 {
     if (this._contentLoaded)
     {
         return;
     }
     this._contentLoaded = true;
     Application.LoadComponent(this, new Uri("/VKClient.Photos;component/PhotosMainPage.xaml", UriKind.Relative));
     this.Header             = (GenericHeaderUC)base.FindName("Header");
     this.itemsControlAlbums = (ExtendedLongListSelector)base.FindName("itemsControlAlbums");
     this.listBoxAlbums      = (MyListBox)base.FindName("listBoxAlbums");
     this.ucPullToRefresh    = (PullToRefreshUC)base.FindName("ucPullToRefresh");
 }
Exemplo n.º 18
0
        public BindBox()
        {
            InitializeComponent();
            FM = new MyWinForm(this);
            FM.SetDefaultStyle("选择");
            conA = MyDB.GetAccessConnection(AccessPath);
            conS = MyDB.GetSqlServerConnection("127.0.0.1", "111", "Northwind");

            CBB = new MyComboBox(comboBox1, "select CustomerID,ContactName from Customers", "ContactName", "CustomerID", conA);
            LB  = new MyListBox(listBox1, "select CustomerID,ContactName from Customers", "CustomerID", "ContactName", conA);
            CLB = new MyCheckedListBox(checkedListBox1, "select CustomerID,ContactName from Customers", "ContactName", "CustomerID", conA);
            //checkedListBox1.Items.Add("selection1", true);//添加选中状态的项
        }
Exemplo n.º 19
0
        void AddSessionToSessionMacro_Click(object sender, EventArgs e)
        {
            MyListBox list = this.Parent.Controls[_target_table] as MyListBox;

            if (list != null)
            {
                list.AddSelected();
            }
            else
            {
                MessageBox.Show("Could not find target list");
            }
        }
Exemplo n.º 20
0
        private void PreviweWindow_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            switch (Keyboard.Modifiers)
            {
            case ModifierKeys.None:
                switch (e.Key)
                {
                case Key.Delete:
                    RemoveItem();
                    break;

                default:
                    break;
                }
                break;

            case ModifierKeys.Alt:
                break;

            case ModifierKeys.Control:
                switch (e.Key)
                {
                case Key.A:
                    MyListBox.SelectAll();
                    break;

                case Key.C:
                    CopyImage();
                    break;

                case Key.S:
                    SaveImage(MyListBox.SelectedItems);
                    break;

                default:
                    break;
                }
                break;

            case ModifierKeys.Shift:
                break;

            case ModifierKeys.Windows:
                break;

            default:
                break;
            }
        }
Exemplo n.º 21
0
        public UserView()
        {
            InitializeComponent();

            dG = new DG(dgUser, snack, snackMessage);

            dataBaseQuery = new DataBaseQuery(snack, snackMessage);

            myListBox = new MyListBox(lbRole, snack, snackMessage);

            comboBoxAddRole = new CB(cbRole, snack, snackMessage);

            comboBoxEditRole = new CB(cbEditRole, snack, snackMessage);

            sB = new SB(snack, snackMessage);
        }
Exemplo n.º 22
0
 void DefineView()
 {
     LB  = new MyListBox(listBox1, "select * from NoteGroups order by GroupOrder", "GroupName", "GroupID", Global.con);
     CBB = new MyComboBox(comboBox1, "select * from NoteGroups order by GroupOrder", "GroupName", "GroupID", Global.con);
     try { LB.SelectedIndex = 0; }
     catch { LB.SelectedIndex = -1; }
     //====
     LV = new MyListViewA(listView1);
     LV.SetDB(Global.con, "Notes");
     LV.ColumnWidths = new int[] { 0, 0, 0, 150, 220 };//列宽(默认80)
     LV.RowHeight    = 30;
     //LV.AlignCenter = true;
     LV.SetStyle("Cambria", 14, FontStyle.Bold);
     LV.QueryFields = "NoteID,GroupID,Content,TimeOfRevision as 修改时间,Title as 笔记标题";
     LV.OrderBy("TimeOfRevision desc");
     ShowData();
 }
Exemplo n.º 23
0
        public ViewCViewModel(IMessageService messageService, MainWindowViewModel mainWindowViewModel)
        {
            _messageService      = messageService;
            _mainWindowViewModel = mainWindowViewModel;

            MyListBox.Add("AAAA");
            MyListBox.Add("BBBB");
            MyListBox.Add("CCCC");

            Areas.Add(new ComboBoxViewModel(1, "横浜"));
            Areas.Add(new ComboBoxViewModel(2, "岐阜"));
            Areas.Add(new ComboBoxViewModel(3, "名古屋"));

            SelectedArea = Areas[1];

            AreaSelectionChanged = new DelegateCommand <object[]>(AreaSelectionChangedExecute);
        }
Exemplo n.º 24
0
 void DefineView()
 {
     LB = new MyListBox(listBox1, "select * from DiaryGroups order by GroupOrder", "GroupName", "GroupID", Global.con);
     GV = new MyGridViewA(dataGridView1);
     try { LB.SelectedIndex = 0; }
     catch { LB.SelectedIndex = -1; }
     GV.SetDB(Global.con, "DiaryRecords");
     GV.ColumnWidths = new int[] { 0, 0, 115, 205 };
     GV.RowHeight    = 30;
     GV.SetStyle("Cambria", 14, FontStyle.Bold);
     GV.QueryFields = "RecordID,GroupID,DateOfRecord as 记录日期,Content as 日记内容";
     GV.OrderBy("DateOfRecord desc,RecordID desc");
     GV.PerPage   = INI.GetPerPage();
     GV.NowPage   = 1;
     GV.KeyColumn = "RecordID";
     ShowData();
 }
Exemplo n.º 25
0
        void AddItemToSet_Click(object sender, EventArgs e)
        {
            ListBox member_list = this.Parent.Controls[_member_list] as ListBox;

            if (member_list != null)
            {
                DataRow newrow = MyListBox.AddSelected(member_list);
                if (UpdateNewRow != null)
                {
                    UpdateNewRow(newrow);
                }
            }
            else
            {
                MessageBox.Show("Could not find member list");
            }
        }
Exemplo n.º 26
0
        public OrderView()
        {
            InitializeComponent();

            dG = new DG(dgOrder, snack, snackMessage);

            sB = new SB(snack, snackMessage);

            lb = new MyListBox(lbSortingCenter, snack, snackMessage);

            comboBoxEmployee = new CB(cbEmployee, snack, snackMessage);

            comboBoxClient = new CB(cbClient, snack, snackMessage);

            comboBoxRecipient = new CB(cbRecipient, snack, snackMessage);

            comboBoxSupplier = new CB(cbSupplier, snack, snackMessage);

            comboBoxArticle = new CB(cbArticle, snack, snackMessage);

            comboBoxSortingCenter = new CB(cbSortingCenter, snack, snackMessage);

            comboBoxNameOrderTiming = new CB(cbNameOrderTiming, snack, snackMessage);

            comboBoxEditEmployee = new CB(cbEditEmployee, snack, snackMessage);

            comboBoxEditClient = new CB(cbEditClient, snack, snackMessage);

            comboBoxEditRecipient = new CB(cbEditRecipient, snack, snackMessage);

            comboBoxEditSupplier = new CB(cbEditSupplier, snack, snackMessage);

            comboBoxEditArticle = new CB(cbEditArticle, snack, snackMessage);

            comboBoxEditSortingCenter = new CB(cbEditSortingCenter, snack, snackMessage);

            comboBoxEditNameOrderTiming = new CB(cbEditNameOrderTiming, snack, snackMessage);

            dataBaseQuery = new DataBaseQuery(snack, snackMessage);

            snackMessage.ActionClick += delegate { dG.CloseSnackbar(); };
        }
Exemplo n.º 27
0
        private void MyListBox_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (MyListBox.Items.Count == 0)
            {
                return;
            }
            int id = MyListBox.SelectedIndex;

            if (e.Delta < 0 && MyListBox.Items.Count > id)
            {
                MyListBox.SelectedIndex++;
            }
            else if (e.Delta > 0 && id > 0)
            {
                MyListBox.SelectedIndex--;
            }
            else
            {
                MyListBox.SelectedIndex = 0;
            }
            MyListBox.ScrollIntoView(MyListBox.Items[MyListBox.SelectedIndex]);
        }
Exemplo n.º 28
0
        void InsertItemIntoSet_Click(object sender, EventArgs e)
        {
            MyListBox member_list = this.Parent.Controls[_member_list] as MyListBox;

            if (member_list != null)
            {
                ListBox target_list = this.Parent.Controls[_target_list] as ListBox;
                if (target_list != null)
                {
                    //object selection = target_list.SelectedItem;
                    DataRow newrow = member_list.InsertSelected();
                    if (newrow != null)
                    {
                        target_list.SelectedIndex = newrow.Table.Rows.IndexOf(newrow);
                    }
                }
                else
                {
                    member_list.InsertSelected();
                }
            }
        }
Exemplo n.º 29
0
 public Records(Form LoginForm = null)
 {
     this.LoginForm = LoginForm;
     InitializeComponent();
     FM = new MyWinForm(this);
     FM.SetDefaultStyle("纪念簿");
     if (LoginForm == null)
     {
         button5.Enabled = false;
     }
     M     = MyModel.GetInstance(Global.con);
     LB    = new MyListBox(listBox2, "select * from Anniversaries order by MonthN,DayN,ID", "Title", "ID", Global.con, true);
     table = LB.DataTable;
     ToAdd();
     if (M.CountAnniRecords() != 0)//有数据
     {
         row = M.GetAnnInfoByID(M.GetNearestDateID()).Rows[0];
         LB.SelectedValue = row["ID"];
         label2.Text      = "最近的纪念日:";
         label4.Text      = row["Title"] + "," + row["MonthN"] + "月" + row["DayN"] + "日。";
     }
 }
        protected override void SetContents(IList contents)
        {               //****************************************
            ListBox  MyListBox;
            ComboBox MyComboBox;

            //****************************************

            if (_ListControl is ListBox)
            {
                MyListBox = (ListBox)_ListControl;

                MyListBox.BeginUpdate();
                MyListBox.Items.Clear();

                foreach (object Value in contents)
                {
                    MyListBox.Items.Add(Value);
                }

                MyListBox.EndUpdate();
            }
            else if (_ListControl is ComboBox)
            {
                MyComboBox = (ComboBox)_ListControl;

                MyComboBox.BeginUpdate();
                MyComboBox.Items.Clear();

                foreach (object Value in contents)
                {
                    MyComboBox.Items.Add(Value);
                }

                MyComboBox.EndUpdate();
            }
        }
Exemplo n.º 31
0
		protected void TestGetParent (MyListBox listbox)
		{
			listbox.Width = 100;
			listbox.Height = 100;
			bool layoutUpdated = false;
			bool loaded = false;
			listbox.LayoutUpdated += (o, e) => layoutUpdated = true;
			listbox.Loaded += (o, e) => loaded = true;

			TestPanel.Children.Add (listbox);
			AutomationPeer peer = null;
			AutomationPeer peerParent = null;
			ListBoxItem item0 = null;
			ListBoxItem item1 = null;
			List<AutomationPeer> children = null;

			EnqueueConditional (() => loaded, "Loaded #0");
			Enqueue (() => {
				item0 = new ListBoxItem () { Content = "Item 0" };
				item1 = new ListBoxItem () { Content = "Item 1" };

				peer = FrameworkElementAutomationPeer.CreatePeerForElement (listbox);
				Assert.IsNotNull (peer, "CreatePeerForElement #0");
				Assert.IsNull (peer.GetChildren (), "GetChildren #1");

				listbox.Items.Add (item0);
				listbox.Items.Add (item1);

				children = peer.GetChildren ();
				Assert.IsNotNull (children, "GetChildren #2");
				Assert.AreEqual (2, children.Count, "GetChildren #3");

				if (listbox.Template == null)
					peerParent = peer;
				else {
					// When default Template is used the Parent is the ScrollViewer 
					// not the ListBox
					ScrollViewer viewer = listbox.GetScrollViewer ();
					Assert.IsNotNull (viewer, "Missing ScrollViewer");
					if (viewer != null)
						peerParent = FrameworkElementAutomationPeer.CreatePeerForElement (viewer);
				}

				Assert.AreEqual (peerParent, children[0].GetParent (), "GetParent #1");
				Assert.AreEqual (peerParent, children[1].GetParent (), "GetParent #2");

				layoutUpdated = false;
				listbox.Items.Remove (item1);
			});
			EnqueueConditional (() => layoutUpdated, "LayoutUpdated #0");
			Enqueue (() => {
				Assert.IsNull (children [1].GetParent (), "GetParent #2");
				Assert.IsNotNull (peer.GetChildren (), "GetChildren #4");
				Assert.AreEqual (1, peer.GetChildren ().Count, "GetChildren #5");
			});
			EnqueueTestComplete ();
		}