示例#1
0
        public MainForm()
        {
            InitializeComponent();

            AppData appData = null;

            if (!File.Exists(NTLIB.Tool.ConfigFilename(typeof(AppData))))
            {
                appData = new AppData();
                NTLIB.Tool.SaveConfig(appData);
            }

            try
            {
                appData = NTLIB.Tool.LoadConfig(typeof(AppData));
            }
            catch(Exception)
            {

            }

            _Twitter = new NTLIB.Twitter(appData.ConsumerKey, appData.ConsumerSecret);

            if(Properties.Settings.Default.AccessToken != "" && Properties.Settings.Default.AccessSecret != "")
            {
                _Twitter.AuthenticateWith(Properties.Settings.Default.AccessToken, Properties.Settings.Default.AccessSecret);
                label1.Text = "認証済";
            }
        }
示例#2
0
        private static void AutoBalanceFollow()
        {
            try
            {
               AppData appData = NTLIB.Tool.LoadConfig(typeof(AppData));
               UserDB db = new UserDB(Properties.Settings.Default.DatabaseFileName);
                if (appData == null) return;
                NTLIB.Twitter tw = new NTLIB.Twitter(appData.ConsumerKey, appData.ConsumerSecret);
                if (Properties.Settings.Default.AccessToken == "" || Properties.Settings.Default.AccessSecret == "") return;
                tw.AuthenticateWith(Properties.Settings.Default.AccessToken, Properties.Settings.Default.AccessSecret);

                List<Int64> whiteListID = db.SelectWhiteList();
                tw.BaranceFollow(whiteListID);
            }
            catch(Exception)
            { }
        }
示例#3
0
        private static void PostPanoramio()
        {
            try
            {
                NTLIB.Panoramio pm = new NTLIB.Panoramio();
                String result = pm.GetRandomPhoto(-3.6d, 58.52d, -5.76d, 57d);

                AppData appData = NTLIB.Tool.LoadConfig(typeof(AppData));
                if (appData == null) return;
                NTLIB.Twitter tw = new NTLIB.Twitter(appData.ConsumerKey, appData.ConsumerSecret);
                if (Properties.Settings.Default.AccessToken == "" || Properties.Settings.Default.AccessSecret == "") return;
                tw.AuthenticateWith(Properties.Settings.Default.AccessToken, Properties.Settings.Default.AccessSecret);

                tw.SendTweet("スコットランド地方の風景 " + result);
            }
            catch(Exception)
            {

            }
        }