示例#1
0
        private void connectButton_Click(object sender, EventArgs e)
        {
            // Using the Server mode to connect to the M-Files Server.
            app = new MFilesServerApplication();

            string host = hostTextBox.Text;

            // Using the default values for connecting to server (HTTP, 2266, current Windows user, etc.),
            // for details and options see:
            // https://www.m-files.com/api/documentation/latest/index.html#MFilesAPI~MFilesServerApplication.html
            conn = app.Connect(NetworkAddress: host);

            //// Populate the combo box so that the user can choose which vault to use.
            //VaultsOnServer vaults = app.GetOnlineVaults();
            //foreach (VaultOnServer v in vaults)
            //{
            //    vaultComboBox.Items.Add(new VaultComboBoxItem(v.Name, v.GUID));
            //}
            //vaultComboBox.Enabled = true;

            //// Must re-start the tool if need to connect to another server.
            //hostTextBox.Enabled = false;
            //connectButton.Enabled = false;
            //EnableTopButtons(true);
            populateVaults();
        }
示例#2
0
        public bool TryConnect()
        {
            MFilesServerApp = new MFilesServerApplication();

            string domain = "null";

            if (MFilesSettings.AuthType == MFAuthType.MFAuthTypeSpecificWindowsUser)
            {
                domain = MFilesSettings.Domain;
            }

            MFServerConnection serverConnection = MFilesServerApp.Connect(
                MFilesSettings.AuthType
                , MFilesSettings.Username
                , MFilesSettings.Password
                , domain
                , null
                , MFilesSettings.Server
                , null
                , ""
                , true);

            if (MFServerConnection.MFServerConnectionAnonymous.Equals(serverConnection))
            {
                Console.WriteLine($"[ERROR] There was a problem connecting to {MFilesSettings.Server}...");
                Console.WriteLine("[ERROR] Incorrect username or password...");
                Console.WriteLine("[ERROR] Please try again...\n");
                return(false);
            }
            return(true);
        }
        private static bool TryConnect()
        {
            MFilesServer = new MFilesServerApplication();
            MFServerConnection serverConnection =
                MFilesServer.Connect(SERVER_CONN.AuthType, SERVER_CONN.Username, SERVER_CONN.Password, SERVER_CONN.Domain, null, SERVER_CONN.Name, null, "", true);

            if (MFServerConnection.MFServerConnectionAnonymous.Equals(serverConnection))
            {
                Console.WriteLine($"[ERROR] There was a problem connecting to {SERVER_CONN.Name}.");
                Console.WriteLine("[ERROR] Incorrect username or password.\n");
                return(false);
            }
            return(true);
        }