/*private ProgressStatusClass ProgressStatus;*/
public frmMain()
{
InitializeComponent();
setWorkingMode(true);
lblInfo.Text = "Loading...";
this.Show();
this.Cursor = Cursors.WaitCursor;
Application.DoEvents();
//Registre = Registry.CurrentUser.CreateSubKey(@"Software\Calexo\CaMuMa");
Registre = Registry.CurrentUser.OpenSubKey(@"Software\Calexo\CaMuMa", true);
if (Registre == null) Registre = Registry.CurrentUser.CreateSubKey(@"Software\Calexo\CaMuMa");
myParams = new Parameters();
loadParams();
//ProgressStatus = new ProgressStatusClass();
userStoreUrl = new Uri(edamBaseUrl + "/edam/user");
userStoreTransport = new THttpClient(userStoreUrl);
userStoreProtocol = new TBinaryProtocol(userStoreTransport);
userStore = new UserStore.Client(userStoreProtocol);
sFolderList = new String[65535];
Application.DoEvents();
bool versionOK = userStore.checkVersion("CaMuMa",
Evernote.EDAM.UserStore.Constants.EDAM_VERSION_MAJOR,
Evernote.EDAM.UserStore.Constants.EDAM_VERSION_MINOR);
//Console.WriteLine("Is my EDAM protocol version up to date? " + versionOK);
Application.DoEvents();
if (!versionOK)
{
MessageBox.Show("Version KO");
}
/*else
{
//lblInfo.Text = "Ready...";
}*/
userStoreProt = new TBinaryProtocol(new THttpClient(userStoreUrl));
userStore = new UserStore.Client(userStoreProt, userStoreProt);
try
{
notestoreUrl = new Uri(userStore.getNoteStoreUrl(myParams.DevKey));
// Set up the NoteStore client
noteStoreTrans = new THttpClient(notestoreUrl);
//noteStoreTrans.setCustomHeader("User-Agent", "Calexo CaMuMa");
//noteStoreTrans.CustomHeaders.Add(
noteStoreProt = new TBinaryProtocol(noteStoreTrans);
noteStore = new NoteStore.Client(noteStoreProt, noteStoreProt);
authToken = myParams.DevKey;
notebooks = noteStore.listNotebooks(authToken);
Console.WriteLine("Found " + notebooks.Count + " notebooks");
//musicNotebook = notebooks[0];
cmbNotebook.Items.Clear();
foreach (Notebook notebook in notebooks)
{
// Console.WriteLine(" * " + notebook.Name);
cmbNotebook.Items.Add(notebook.Name);
//if (notebook.DefaultNotebook)
if (notebook.Name == myParams.Notebook)
{
musicNotebook = notebook;
cmbNotebook.Text = notebook.Name;
}
}
Application.DoEvents();
tags = noteStore.listTags(authToken);
Console.WriteLine("Found " + tags.Count + " tags");
lblInfo.Text = "Ready !";
setWorkingMode(false);
}
catch (Evernote.EDAM.Error.EDAMUserException e)
{
//mes e.ErrorCode;
lblInfo.Text = "ERREUR : " + e.ErrorCode;
setWorkingMode(false);
btnGo.Enabled = false;
}
this.Cursor = DefaultCursor;
}