Exemplo n.º 1
0
        public CSPMain()
        {
            InitializeComponent();
            manager = new UsbManager();
            UsbDiskCollection disks = manager.GetAvailableDisks();

            //            textBox.AppendText(CR);
              //          textBox.AppendText("Available USB disks" + CR);

            //        foreach (UsbDisk disk in disks)
              //      {
            //        textBox.AppendText(disk.ToString() + CR);
              //  }

             //   textBox.AppendText(CR);

            manager.StateChanged += new UsbStateChangedEventHandler(DoStateChanged);
            sendtonotify();
            timecount = 0;
            MinutesTimer = 29;
            SecondsTimer = 0;
            Seconds.Start();

            CheckConnection();
            label7.Text = "29";

            ConnectionBallon();
            if (IsConnectedITAssets == true && IsConnectedUser == true)
            {
                RefreshData();
                        }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize a new instance of the dialog using the given Controller.
        /// </summary>
        /// <param name="controller"></param>

        public SynchronizeDialog(Controller controller)
            : this()
        {
            this.controller = controller;

            this.manager             = new UsbManager();
            this.disks               = manager.GetAvailableDisks();
            this.playlists           = null;
            this.percentageCompleted = 0;

            this.selector.Loaded += new RoutedEventHandler(DoLoaded);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize a new instance of the dialog using the given Controller.
        /// </summary>
        /// <param name="controller"></param>
        public SynchronizeDialog(Controller controller)
            : this()
        {
            this.controller = controller;

            this.manager = new UsbManager();
            this.disks = manager.GetAvailableDisks();
            this.playlists = null;
            this.percentageCompleted = 0;

            this.selector.Loaded += new RoutedEventHandler(DoLoaded);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Release manages resources.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void DoClosed(object sender, EventArgs e)
        {
            if (percentageCompleted > 0)
            {
                controller.Librarian.ProgressChanged -= new ProgressChangedEventHandler(DoProgressChanged);
            }

            // must detach collection from WPF control otherwise will not dispose
            selector.DataContext = null;
            disks.Clear();
            disks = null;

            playlistBox.ItemsSource = null;

            playlists.Dispose();
            playlists = null;

            manager.Dispose();
            manager = null;

            controller = null;
        }
Exemplo n.º 5
0
        public void ManagerTest()
        {
            manager = new UsbManager();
            UsbDiskCollection disks = manager.GetAvailableDisks();

            foreach (UsbDisk disk in disks)
            {
                Console.WriteLine(String.Format(
                    "{0} {1} ({2})", disk.Name, disk.Volume, disk.Model));
            }

            // need to set GetDiskInformation to 'public' for these lines:
            //UsbDisk d = new UsbDisk("T:", null, null);
            //manager.GetDiskInformation(d);

            manager.StateChanged += new UsbStateChangedEventHandler(manager_StateChanged);

            ManualResetEvent reset = new ManualResetEvent(false);
            reset.WaitOne(120000, false);
        }
Exemplo n.º 6
0
        private void GetUdiskInfo()
        {
            string newlist = string.Empty;
            UsbManager manager = new UsbManager();
            try
            {
                diskCollection.Clear();
                //UsbDiskCollection disks = manager.GetAvailableDisks();
                UsbDisk udChoose = new UsbDisk(MsgManager.GetResString("Msg_chooseud", MsgManager.ci));
                diskCollection.Add(udChoose);

                //if (disks == null) { return; }
                foreach (UsbDisk disk in manager.GetAvailableDisks())
                {
                    diskCollection.Add(disk);
                    newlist += disk.ToString();

                }
                if (newlist != currentlist)
                {

                    currentlist = newlist;

                    OutText(false, diskCollection);
                }
            }
            catch (Exception ex) { Log.WriteLog("GetUdiskInfo.log", ex.ToString()); }
            finally { manager.Dispose(); }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Release manages resources.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DoClosed(object sender, EventArgs e)
        {
            if (percentageCompleted > 0)
            {
                controller.Librarian.ProgressChanged -= new ProgressChangedEventHandler(DoProgressChanged);
            }

            // must detach collection from WPF control otherwise will not dispose
            selector.DataContext = null;
            disks.Clear();
            disks = null;

            playlistBox.ItemsSource = null;

            playlists.Dispose();
            playlists = null;

            manager.Dispose();
            manager = null;

            controller = null;
        }