Пример #1
0
        public dmTabItem()
        {
            Header = new dmTabItemHeader();

            ((dmTabItemHeader)Header).txtHeader.Text = string.Format("{0}{1}", TAG_NEW_TAB_TEXT, count++);

            MaxWidth = DEFAULT_MAX_WIDTH;

            // 우선 드래그앤 드랍은 나중에 구현
            //
            AllowDrop = false;

            var menu = new ContextMenu();

            var menuItem_Rename = new MenuItem()
            {
                Header = "Rename"
            };

            menuItem_Rename.Click += (s, args) =>
            {
                ContextMenu cm = (ContextMenu)ContextMenu.ItemsControlFromItemContainer((MenuItem)args.OriginalSource);
                UIElement   placementTarget = cm.PlacementTarget;
                dmTabItem   header          = placementTarget as dmTabItem;

                Point position        = placementTarget.PointToScreen(new Point(0d, 0d)),
                      controlPosition = this.PointToScreen(new Point(0d, 0d));

                RenameWindow renameWindow = new RenameWindow();
                renameWindow.InitializeTabName     = header.HeaderText;
                renameWindow.Owner                 = Application.Current.MainWindow;
                renameWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;

                if (renameWindow.ShowDialog() == true)
                {
                    string rename = renameWindow.txtRename.Text;
                    Debug.WriteLine(rename);
                    header.HeaderText = rename;
                }
            };

            menu.Items.Add(menuItem_Rename);

            ContextMenu = menu;
        }
Пример #2
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            isTh = false;

            musicPlayer.DisablePlaybackStopped();
            musicPlayer.CleanupPlayback();

            AppSetting appSetting = new AppSetting();

            appSetting.volumn = 0;

            foreach (var item in extendedTabControl.Items)
            {
                AppSetting.TabItem appSettingTabItem = new AppSetting.TabItem();

                dmTabItem tabItem = (dmTabItem)item;

                appSettingTabItem.Name = tabItem.HeaderText;

                dmItemContent content = (dmItemContent)tabItem.Content;

                foreach (var musicItem in content.musicList.Items)
                {
                    var mItem = musicItem as MusicItem;
                    mItem.Playing = "";
                    appSettingTabItem.tabItem.Add(mItem);
                }

                appSetting.tabItemList.Add(appSettingTabItem);
            }

            appSetting.Left   = this.Left;
            appSetting.Top    = this.Top;
            appSetting.Width  = this.Width;
            appSetting.Height = this.Height;

            appSetting.volumn = musicPlayer.Volume;

            appSetting.Save();
        }