public static TwitterController GetController()
        {
            lock (c_lock)
            {
                if (c_objInstance == null)
                    c_objInstance = new TwitterController();
            }

            return c_objInstance;
        }
示例#2
0
        public static TwitterController GetController()
        {
            lock (c_lock)
            {
                if (c_objInstance == null)
                {
                    c_objInstance = new TwitterController();
                }
            }

            return(c_objInstance);
        }
        public MainController() : base()
        {
            m_twController = TwitterController.GetController();

            m_twController.Accounts.AccountSwitched    += new EventHandler(m_aclAccounts_AccountSwitched);
            m_twController.Accounts.AccountAdded       += new AccountList.AccountHandler(m_aclAccounts_AccountAdded);
            m_twController.Accounts.AccountRemoved     += new AccountList.AccountHandler(m_aclAccounts_AccountRemoved);
            m_twController.Accounts.UserObjectReceived += new AccountList.AccountHandler(m_aclAccounts_UserObjectReceived);

            m_twController.Accounts.Load();
            m_twController.ConnectActiveAccount();
        }
        public MainController() : base()
        {
            m_twController = TwitterController.GetController();

            m_twController.Accounts.AccountSwitched += new EventHandler(m_aclAccounts_AccountSwitched);
            m_twController.Accounts.AccountAdded += new AccountList.AccountHandler(m_aclAccounts_AccountAdded);
            m_twController.Accounts.AccountRemoved += new AccountList.AccountHandler(m_aclAccounts_AccountRemoved);
            m_twController.Accounts.UserObjectReceived += new AccountList.AccountHandler(m_aclAccounts_UserObjectReceived);

            m_twController.Accounts.Load();
            m_twController.ConnectActiveAccount();
        }
示例#5
0
        private void m_fpPrefForm_CredentialsRemoved(object sender, string sScreenName)
        {
            AccountList alAccounts = TwitterController.GetController().Accounts;

            for (int i = 0; i < alAccounts.Count; i++)
            {
                if (alAccounts[i].Credentials.ClientUsername == sScreenName)
                {
                    alAccounts.RemoveAt(i);
                    alAccounts.Save();
                }
            }
        }
示例#6
0
        public FrmMain()
        {
            InitializeComponent();
            //IsolatedStorageManager.GetManager().Store.DeleteFile(Literals.C_ACCOUNT_FILE);

            //assignments
            m_sbbSelected = sbbTimeline;

            //object creation
            m_ftTweetForm = new FrmTweet(this);
            m_fpPrefForm  = new FrmPreferences();

            //timeline event hookups
            tmlTimeline.StatusTextClicked += new Timeline.StatusTextClickedHandler(tmlTimeline_StatusTextClicked);
            tmlTimeline.RetweetClicked    += new Timeline.StatusOptionClickedHandler(tmlTimeline_RetweetClicked);
            tmlTimeline.FavoriteClicked   += new Timeline.StatusOptionClickedHandler(tmlTimeline_FavoriteClicked);
            tmlTimeline.QuoteTweetClicked += new Timeline.StatusOptionClickedHandler(tmlTimeline_QuoteTweetClicked);
            tmlTimeline.ReplyClicked      += new Timeline.StatusOptionClickedHandler(tmlTimeline_ReplyClicked);

            //preference form event hookups
            m_fpPrefForm.CredentialsAdded   += new FrmAddAccount.OAuthDanceHandler(m_fpPrefForm_CredentialsAdded);
            m_fpPrefForm.CredentialsRemoved += new FrmPreferences.CredentialsRemovedHandler(m_fpPrefForm_CredentialsRemoved);
            m_fpPrefForm.AccountList         = TwitterController.GetController().Accounts;

            //form event hookups
            m_ftTweetForm.TweetClicked += new FrmTweet.TweetClickedEventHandler(m_ftTweetForm_TweetClicked);
            tsbTimelineScroller.Scroll += new ScrollEventHandler(tsbTimelineScroller_Scroll);
            tmlTimeline.ScrolledToTop   = true;

            if (m_twController.Accounts.Count == 0)
            {
                tmlTimeline.DisableLoadingAnimation();
            }

            //@TODO: do this for testing purposes only
            if (Literals.C_ENVIRONMENT == Env.Development)
            {
                UserTimeline utLine = new UserTimeline(JsonParser.GetParser().ParseFile("../../../../Documents/test/tweets/tweets2.json").Root.ToList());
                for (int i = 0; i < utLine.Statuses.Count; i++)
                {
                    Account_UserStream_Receive(this, new JsonDocument(utLine.Statuses[i].Object), API.Streaming.UserStream.ReceiveType.Tweet);
                }
            }
        }
示例#7
0
 private void m_fpPrefForm_CredentialsAdded(object sender, OAuthCredentials oaCredentials)
 {
     TwitterController.GetController().AddNewAccount(oaCredentials);
 }