Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LeenzeryDev committed Nov 27, 2022
1 parent 4ef5160 commit 015072c
Show file tree
Hide file tree
Showing 11 changed files with 1,425 additions and 0 deletions.
4 changes: 4 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

</configuration>
91 changes: 91 additions & 0 deletions LoginForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions LoginForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using OpenVkNetApi;
using System.Configuration;

namespace Spotify2OVK
{
public partial class LoginForm : Form
{
private OVkApi api = new();
private Configuration config;
private AppSettingsSection app;
public LoginForm()
{
InitializeComponent();
MaximizeBox = false;
config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
app = config.AppSettings;
}

private void loginButton_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(login.Text) && !string.IsNullOrEmpty(password.Text) && !string.IsNullOrEmpty(instance.Text))
{
app.Settings.Add("ovkToken", api.Authorization(login.Text, password.Text, instance.Text).access_token);
app.Settings.Add("ovkInstance", instance.Text);
config.Save(ConfigurationSaveMode.Modified);
ToMainForm();
}
else
{
MessageBox.Show("Заполните все поля");
}
}
private void ToMainForm() {
MainForm form = new();
Hide();
form.ShowDialog();
Close();
}
}
}
Loading

0 comments on commit 015072c

Please sign in to comment.