PutioFS.Windows.WinMounter.TryMount C# (CSharp) Method

TryMount() public method

public TryMount ( object Sender, EventArgs e ) : void
Sender object
e System.EventArgs
return void
        public void TryMount(object Sender, EventArgs e)
        {
            try
            {
                this.MainWindow.ToggleMountUnmount(false);
                Api api = this.GetApiInfoFromSettings();
                api.GetUserInfo();
                this.PutioFileSystem = new PutioFileSystem(api);
                Thread dokan_thread = new Thread(PutioDokanOperations._DokanMount);
                dokan_thread.Start(this);
                Mounted = true;
                this.MainWindow.ToggleMountUnmount(true);
            }
            catch (PutioException)
            {
                MessageBox.Show("Put.io user not found.");
                this.SettingsForm.InvokeSettings();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not connect to Put.io");
                this.SettingsForm.InvokeSettings();
            }
        }

Usage Example

示例#1
0
        public static void Main(string[] args)
        {
            if (Environment.Version.Major < 4)
            {
                MessageBox.Show("You need to install Microsoft .NET Framework Version 4 in order to use put.io mounter.");
                return;
            }

            WinMounter mounter = new WinMounter(WinMounter.GetAvailableDriveLetter('P'));

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(mounter.CrashLogger);
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            mounter.SettingsForm = new SettingsForm(mounter);
            mounter.MainWindow   = new MainWindow(mounter);
            mounter.MainWindow.InitializeTrayIcon();
            mounter.MainWindow.GoInvisible();
            mounter.Silent = args.Contains(@"/silent");

            try
            {
                mounter.TryMount(null, null);
                mounter.RefreshCacheSize();
                mounter.MainWindow.notify_icon.Visible = true;
                Application.Run();
                logger.Debug("Exiting.");
                mounter.MainWindow.notify_icon.Visible = false;
            }
            finally
            {
                PutioDokanOperations._DokanUnmount(mounter.DriveLetter);
            }
        }
All Usage Examples Of PutioFS.Windows.WinMounter::TryMount