Open EraYaN opened 11 years ago
Depends on how much work it is getting my build-script to do this automatically.
That would be awesome. BTW did you ever get this working in an WPF .NET4.5 project (GUI)? Console is fine...
EDIT: where to does it log? (NLog get's loaded but where does it store?)
NLog loggs depending on it's config, which can be set in code or in a nlog.conf file. You should look up nlog. Also, it works on WinForms, so I guess it should work the same in WPF, though never tried.
For now I've added a WPF test client (and tested that it works).
It seems that here Starting mainthread takes ages. Unless I make the timeout in wait short then just after time out it successfully logs in... (Not the NuGet release (I only got access violations out of that.) but one build from source (SpotiFire.dll and SpotiFire.Native.dll)
http://erayan.eu/jing/2013-04-30_0010.png
It seems to me that
[code] return Task::Factory->StartNew(gcnew Func<Session ^>(create, &$session$create::run)); (ln 250, Session.cpp) [/code]
Never actually returns something. The Session does get created and the main thread started.
EDIT: I saw how you did it in your WPF test, that way it did work. (With both build from source and from NuGet)
You probably have a deadlock. How/where do you await the creation of the session?
using System;
using SpotiFire;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SpotiFireWPF
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
const string CLIENT_NAME = "SpotiFireTest";
static byte[] key = new byte[] {
/* key here */
};
static string cache = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Testing", CLIENT_NAME, "cache");
static string settings = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Testing", CLIENT_NAME, "settings");
static string userAgent = CLIENT_NAME;
static Session session;
public MainWindow()
{
InitializeComponent();
}
private static async Task Run()
{
MessageBox.Show("Creating Session.");
session = await Spotify.CreateSession(key, cache, settings, userAgent);
Error err = await session.Login("username", "password", false); // search playlists, play music etc
}
private static async Task RunLogOut()
{
await session.Logout();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (session != null)
RunLogOut().Wait();
}
private void button_Click(object sender, RoutedEventArgs e)
{
if (Run().Wait(40000)) //returned false
{
label.Content = "Done.";
}
else
{
label.Content = "Failed.";
MessageBox.Show(Spotify.Task.ToString()); //nothing special
}
}
}
}
With a button called button and a label called label.
Yeah, you make a deadlock by calling "Run.Wait".
So Run()
should do it?
Await run
Anyone know how I can validate that the symbolsources-packages I generate atm is somewhat ... reasonable?
Could you please include the symbol packages like they do it here: http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-symbol-package