Beispiel #1
0
        /// <summary>
        /// Строем список дисков (создаём кнопки)
        /// </summary>
        private void _BuildDrives()
        {
            DriveInfo[] drives = DriveInfo.GetDrives();

            ugDrives.Children.Clear();

            //Добавляем кнопку доступа к системным папкам
            SystemFoldersButton sfb = new SystemFoldersButton();

            sfb.GoToFolder += delegate(object sender, string path)
            {
                this.Path = path;
            };
            ugDrives.Children.Add(sfb);

            foreach (var d in drives)
            {
                //Button btnDrive = new Button();
                DriveButton btnDrive = new DriveButton(d);

                //btnDrive.Content = d.Name[0].ToString();
                //Создаём подсказку для диска
                btnDrive.ToolTip = new DriveHint(d);
                ToolTipService.SetBetweenShowDelay(btnDrive, 20000);

                btnDrive.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(btnDrive_PreviewMouseLeftButtonDown);

                btnDrive.MouseRightButtonDown += new MouseButtonEventHandler(btnDrive_MouseRightButtonDown);
                //Сам экземпляр диска держим в теге
                btnDrive.Tag = d;
                ugDrives.Children.Add(btnDrive);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Для вызова контекстного меню проводника для кнопки диска
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDrive_MouseRightButtonDown(Object sender, MouseButtonEventArgs e)
        {
            DriveButton btnDrive = (DriveButton)sender;
            DriveInfo   drive    = (DriveInfo)btnDrive.Tag;


            System.Drawing.Point dPoint = new System.Drawing.Point();

            Point point = btnDrive.PointToScreen(new Point());

            dPoint.X = Convert.ToInt32(point.X);
            dPoint.Y = Convert.ToInt32(point.Y);

            ExplorerNet.Tools.ShellContextMenu scm = new Tools.ShellContextMenu();
            scm.ShowContextMenu(drive, dPoint);
        }
Beispiel #3
0
        /// <summary>
        /// Обработчик щелчка мыши по кнопке диска
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDrive_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            DriveButton btnDrive = (DriveButton)sender;
            DriveInfo   di       = (DriveInfo)btnDrive.Tag;

            if (di.IsReady)
            {
                //Если диск готов, отображаем список файлов
                _BuildFileSystemView(di.RootDirectory);
            }
            else
            {
                //Если нет, предупреждающее сообщение
                MessageBox.Show("The drive is not ready!", di.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Beispiel #4
0
        void ReleaseDesignerOutlets()
        {
            if (DriveButton != null)
            {
                DriveButton.Dispose();
                DriveButton = null;
            }

            if (RideButton != null)
            {
                RideButton.Dispose();
                RideButton = null;
            }

            if (BackgroundImageView != null)
            {
                BackgroundImageView.Dispose();
                BackgroundImageView = null;
            }
        }
Beispiel #5
0
 public void PopulateButton(DriveButton button, AudioSource audioSourceDown, AudioSource audioSourceUp)
 {
     base.PopulateButton(button, audioSourceDown, audioSourceUp);
     button.filePanel = filePanel;
 }
Beispiel #6
0
        protected override void AddButton(GameObject target, AudioSource audioSourceDown, AudioSource audioSourceUp)
        {
            DriveButton button = Undoable.AddComponent <DriveButton>(target);

            PopulateButton(button, audioSourceDown, audioSourceUp);
        }