Beispiel #1
0
 public InfoPage() : base("個人資訊")
 {
     {
         TCmain = new MyTabControl();
         TCmain.TabPages.Add(name            = new TextPage("暱稱 (name)", "loser"));
         TCmain.TabPages.Add(age             = new TextPage("年齡 (age)", "23"));
         TCmain.TabPages.Add(gender          = new TextPage("性別 (gender)", "male"));
         TCmain.TabPages.Add(introduction    = new TextPage("自介 (introduction)", "I get hurt a lot in that chatroom war..."));
         TCmain.TabPages.Add(filter_function = new TextPage("篩選函式 (filter_function)", "int filter_function(struct User user)\r\n" +
                                                            "{\r\n" +
                                                            "    if(user.age<18 || user.age>25) return 0;//這樣可以篩掉不是大學年紀的人\r\n" +
                                                            "    return 1;\r\n" +
                                                            "}\r\n" +
                                                            "/*(修改上面這個函式來篩選欲匹配的對象,下面是User的定義。程式語言:C(不是C++))\r\n" +
                                                            "struct User {\r\n" +
                                                            "    char name[33],\r\n" +
                                                            "    unsigned int age,\r\n" +
                                                            "    char gender[7],\r\n" +
                                                            "    char introduction[1025]\r\n" +
                                                            "};*/"));
         filter_function.TXB.Font = new Font("Consolas", 15);
         TCmain.TabPages.Add(ip   = new TextPage("IP", "140.112.30.32"));
         TCmain.TabPages.Add(port = new TextPage("Port", "10000"));
         this.Controls.Add(TCmain);
     }
 }
Beispiel #2
0
 public Form1()
 {
     this.Text = "NTU WooTalk";
     this.Icon = Properties.Resources.clock_reveal_00095_600;
     this.Size = new Size(1000, 700);
     {
         TCmain = new MyTabControl();
         {
             TPlog  = new LogPage();
             TPinfo = new InfoPage();
             TPmsg  = new MessagePage(TPinfo, TPlog);
             TCmain.TabPages.Add(TPmsg);
         }
         {
             TCmain.TabPages.Add(TPinfo);
         }
         {
             TCmain.TabPages.Add(TPlog);
         }
         {
             TCmain.TabPages.Add(new AboutPage());
         }
         this.Controls.Add(TCmain);
     }
     this.FormClosing += Form1_FormClosing;
     Log("初始化完成!");
     this.Shown += Form1_Shown;
 }
        private void CopyButton_OnClick(object sender, RoutedEventArgs e)
        {
            SongTab sTab;
            ObservableCollection <Song> targetCollection;

            if (TabsComboBox.SelectedItem == null)
            {
                sTab = AddNewTab();
                if (sTab == null)
                {
                    return;
                }
                targetCollection = sTab.SongCollection;
            }
            else
            {
                sTab             = ((SongTab)TabsComboBox.SelectedItem);
                targetCollection = sTab.SongCollection;
            }
            var items = MyTabControl.GetChildOfType <ListView>().SelectedItems;

            foreach (var item in items)
            {
                targetCollection.Add((Song)((Song)item).Clone());
            }
            MyTabControl.SelectedItem = sTab;
        }
        private void DownloadButtonClick(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            var songs     = MyTabControl.GetChildOfType <ListView>().SelectedItems.Cast <Song>();
            var songsList = songs as Song[] ?? songs.ToArray();

            if (!songsList.Any())
            {
                return;
            }
            _tokenSource           = new CancellationTokenSource();
            CancelButton.IsEnabled = true;
            if (songsList.Length == 1)
            {
                songsList.First().DownloadAudio(_tokenSource.Token, dialog.SelectedPath, this);
                return;
            }
            CancelButton.IsEnabled = true;
            Song.DownloadAudio(songsList, _tokenSource.Token, dialog.SelectedPath, this);
        }
Beispiel #5
0
        // Populate TabControl with some contents
        private void InitTabControl()
        {
            for (int i = 0; i < 7; i++)  // create five tab with different background color ...
            {
                MyTabControl.addNewTabItem(initObject(), "TAB" + i.ToString());
            }

            // MUST set UserControl parameters "ParentWindow"  Very Important !!!!
            MyTabControl.ParentWindow = this;
        }
        private void DeleteButton_OnClick(object sender, RoutedEventArgs e)
        {
            var selectedSongs = MyTabControl.GetChildOfType <ListView>();

            if (selectedSongs.SelectedItems.Count < 0)
            {
                return;
            }
            var items = selectedSongs.SelectedItems;

            for (var i = 0; i < items.Count; i++)
            {
                ((Collection <Song>)selectedSongs.ItemsSource).Remove((Song)items[i]);
            }
        }
        private void ChangeButton_OnClick(object sender, RoutedEventArgs e)
        {
            int count = MyTabControl.GetChildOfType <ListView>().SelectedItems.Count;

            if (count > 1)
            {
                StateLabel.Text = "Choose only one song";
                return;
            }
            if (count == 0)
            {
                StateLabel.Text = "Choose song";
                return;
            }
            var eW = new EditWindow((Song)MyTabControl.GetChildOfType <ListView>().SelectedItem, User.AccessToken);

            eW.ShowDialog();
        }
Beispiel #8
0
        public Form1()
        {
            Trace.UseGlobalLock = false;
            //InitializeComponent();
            this.Size        = new Size(1000, 600);
            this.FormClosed += Form1_FormClosed;
            //sam = new SAM();
            //sam.StatusChanged += (s) => { this.Invoke(new Action(() => this.Text = $"[*] {s}")); };
            //sm = new SimpleMethod();
            //sm.StatusChanged += (s) => { this.Invoke(new Action(() => this.Text = $"[*] {s}")); };
            //sa.StatusChanged += (s) => { this.Invoke(new Action(() => this.Text = $"[*] {s}")); };
            this.Shown += Form1_Shown;
            var tc = new MyTabControl();

            tc.TabPages.Add(new TrieTabPage());
            tc.TabPages.Add(new SATabPage());
            tc.TabPages.Add(new ToolsTabPage());
            this.Controls.Add(tc);
        }
 private void PlayButton_OnClick(object sender, RoutedEventArgs e)
 {
     if (!MyTabControl.GetChildOfType <ListView>().SelectedItems.Cast <Song>().ToList().Any())
     {
         _selectedSongs =
             new ObservableCollection <Song>(
                 MyTabControl.GetChildOfType <ListView>().ItemsSource.Cast <Song>().ToList());
     }
     else
     {
         _selectedSongs =
             new ObservableCollection <Song>(
                 MyTabControl.GetChildOfType <ListView>().SelectedItems.Cast <Song>().ToList());
     }
     _index = -1;
     _audioTimeUpdateTimer.Start();
     _isPlaying = true;
     CurrentSongsListBox.ItemsSource = _selectedSongs;
     PlayNextSong();
 }
        /// <summary>
        /// Reads the data in from the database and stores it locally.
        /// </summary>
        private async void Load()
        {
            // Run on a background thread
            await Task.Run(() =>
            {
                // Calculate the offset points
                mDatabase.GetBounds(mTopLeft, mBottomRight);

                // Load the polygons from the database
                mDataPoints.AddRange(mDatabase.GetPolygons(mTopLeft));

                // Load the roads from the database
                mDataPoints.AddRange(mDatabase.GetRoads(mTopLeft));

                // Load the lines from the database
                mDataPoints.AddRange(mDatabase.GetLines(mTopLeft));

                // Callback on main thread
                RunOnUiThread(o => MyTabControl.LoadDataPoints(mDataPoints));
            });
        }
 /// <summary>
 /// Deselects all potential options for generation.
 /// </summary>
 /// <param name="sender">The event sender</param>
 /// <param name="e">The event arguments</param>
 private void OnClick_DeselectAll(object sender, RoutedEventArgs e)
 {
     MyTabControl.DeselectAll();
 }
Beispiel #12
0
        // Set some object to new TAB (it can be any object - image, table, text, any...)
        private object initObject()
        {
            Grid grd = new Grid();

            grd.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, MyTabControl.rnd(), MyTabControl.rnd(), MyTabControl.rnd()));
            return(grd);
        }
Beispiel #13
0
 public Private2Public()
 {
     this.mcv = new MultiChartsView();
     this.mtc = new MyTabControl();
 }
Beispiel #14
0
 public ControlCollection(MyTabControl owner)
     : base(owner)
 {
 }