예제 #1
0
        public static void RunMultiThreadWithSingleUser()
        {
            Logger logger = Logger.GetInstance(Logger.Levels.ALL, "/Users/Documents/GitLab/csharp_sdk_log.log");

            DataCenter.Environment env = USDataCenter.PRODUCTION;

            UserSignature user1 = new UserSignature("*****@*****.**");

            //TokenStore tokenstore = new DBStore(null, null, null, null, null);

            TokenStore tokenstore = new FileStore("/Users/Documents/GitLab/csharp_sdk_token.txt");

            Token token1 = new OAuthToken("1000.xxxxxx", "xxxxxx", "1000.xxxxxx.xxxxxx", TokenType.REFRESH, "https://www.zoho.com");

            string resourcePath = "/Users/Documents/GitLab/SampleApp/zohocrm-csharp-sdk-sample-application";

            SDKConfig config = new SDKConfig.Builder().SetAutoRefreshFields(true).Build();

            SDKInitializer.Initialize(user1, env, token1, tokenstore, config, resourcePath, logger);

            MultiThread multiThread1 = new MultiThread();

            Thread thread1 = new Thread(() => multiThread1.GetRecords("Quotes"));

            thread1.Start();

            Thread thread2 = new Thread(() => multiThread1.GetContactRoles());

            thread2.Start();

            thread1.Join();

            thread2.Join();
        }
예제 #2
0
        public static void RunMultiThreadWithSingleUser()
        {
            Logger logger = new Logger.Builder()
                            .Level(Logger.Levels.ALL)
                            .FilePath("/Users/Documents/csharp_sdk_log.log")
                            .Build();

            DataCenter.Environment env = USDataCenter.PRODUCTION;

            UserSignature user1 = new UserSignature("*****@*****.**");

            //TokenStore tokenstore = new DBStore.Builder()
            //    .Host("host")
            //    .TableName("tablename")
            //    .Password("password")
            //    .Build();

            TokenStore tokenstore = new FileStore("/Users/Documents/csharp_sdk_token.txt");

            Token token1 = new OAuthToken.Builder()
                           .ClientId("1.xxxx")
                           .ClientSecret("xxxx")
                           //.GrantToken("1.xxxx.xxxx")
                           .RefreshToken("1.xxxx.xxxx")
                           .RedirectURL("https://www.zoho.com")
                           .Build();

            string resourcePath = "/Users/Documents";

            SDKConfig config = new SDKConfig.Builder()
                               .AutoRefreshFields(true)
                               .Build();

            new SDKInitializer.Builder()
            .User(user1)
            .Environment(env)
            .Token(token1)
            .Store(tokenstore)
            .SDKConfig(config)
            .ResourcePath(resourcePath)
            .Logger(logger)
            .Initialize();

            MultiThread multiThread1 = new MultiThread();

            Thread thread1 = new Thread(() => multiThread1.GetRecords("Quotes"));

            thread1.Start();

            Thread thread2 = new Thread(() => multiThread1.GetContactRoles());

            thread2.Start();

            thread1.Join();

            thread2.Join();
        }