Beispiel #1
0
        private async void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text != string.Empty && txtPassword.Text != string.Empty)
            {
                txtUsername.Enabled = false;
                txtPassword.Enabled = false;
                btnLogin.Enabled    = false;
                lbSignUp.Enabled    = false;
                cbRemember.Enabled  = false;
                Cursor = Cursors.WaitCursor;

                var response = await BoardApi.LoginAsync(txtUsername.Text, txtPassword.Text);

                if (response != null && response.status == "1")
                {
                    Properties.Settings.Default.Remember = cbRemember.Checked;
                    if (cbRemember.Checked)
                    {
                        Properties.Settings.Default.Username = txtUsername.Text;
                        Properties.Settings.Default.Password = txtPassword.Text;
                    }
                    Properties.Settings.Default.Save();

                    Hide();
                    new FrmMain(response).ShowDialog();
                    Close();
                }
                else if (response == null)
                {
                    txtUsername.Enabled = true;
                    txtPassword.Enabled = true;
                    btnLogin.Enabled    = true;
                    lbSignUp.Enabled    = true;
                    cbRemember.Enabled  = true;
                    MessageBox.Show("An unknown error occured, please try again later.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    txtUsername.Enabled = true;
                    txtPassword.Enabled = true;
                    btnLogin.Enabled    = true;
                    lbSignUp.Enabled    = true;
                    cbRemember.Enabled  = true;
                    MessageBox.Show(response.msg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("Please enter your forum details to proceed.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            Cursor = Cursors.Default;
        }
        /// <summary>
        /// Creates a client to work with VK API methods.
        /// </summary>
        public CitrinaClient()
        {
            AuthHelper = new AuthHelper();
            Execute    = new ExecuteApi();

            Account       = new AccountApi();
            Ads           = new AdsApi();
            Apps          = new AppsApi();
            Auth          = new AuthApi();
            Board         = new BoardApi();
            Database      = new DatabaseApi();
            Docs          = new DocsApi();
            Fave          = new FaveApi();
            Friends       = new FriendsApi();
            Gifts         = new GiftsApi();
            Groups        = new GroupsApi();
            Leads         = new LeadsApi();
            Likes         = new LikesApi();
            Market        = new MarketApi();
            Messages      = new MessagesApi();
            Newsfeed      = new NewsfeedApi();
            Notes         = new NotesApi();
            Notifications = new NotificationsApi();
            Orders        = new OrdersApi();
            Pages         = new PagesApi();
            Photos        = new PhotosApi();
            Places        = new PlacesApi();
            Polls         = new PollsApi();
            Search        = new SearchApi();
            Secure        = new SecureApi();
            Stats         = new StatsApi();
            Status        = new StatusApi();
            Storage       = new StorageApi();
            Users         = new UsersApi();
            Utils         = new UtilsApi();
            Video         = new VideoApi();
            Wall          = new WallApi();
            Widgets       = new WidgetsApi();
        }
        public MainWindow()
        {
            var appName = Process.GetCurrentProcess().ProcessName + ".exe";

            SetIE8KeyforWebBrowserControl(appName);

            InitializeComponent();

            //var bootstrapper = Bootstrapper.Current;
            //bootstrapper.Run();

            DispatcherHelper.SetDispatherAsDefault();
            WebWorker.SetBrowser((MyWebBrowser.Child as System.Windows.Forms.WebBrowser));

            ApplicationApi.Auth("penzin", "super");

            BoardApi.CheckIntegrity("Avito");
            //BoardApi.GetBulletins("Avito");
            //BoardApi.GetXlsBulletins("Avito");
            //BoardApi.EditBulletinsFromXls("Avito");
            //BoardApi.AddBulletinsFromXls("Avito");
            //BoardApi.GetXlsGroup("Avito");
            //BulletinContainerList.ExecuteAll();
        }