Team Foundation Error: You are not logged into Windows Live Messenger
Apparently windows live can interface with TFS for collaboration purposes but if you're not interested in using that feature here is how to be rid of the annoying popup:
1. Open VS Team Explorer
2. Right-click on 'Team Members' and select 'Personal Settings'
3. Under 'Collaboration' click 'Change'
4. On the opened dialog select 'None' and click 'OK'
Convert from IEnumerable<gobject> to IEnumerable<x>
IEnumerable<object> objEnum = GetData();
IEnumerable<DomainObject> domainObjEnum = objEnum.Cast<DomainObject>().ToList();
The same process can be used in reverse.
Free ASP.NET 4.0 hosting
http://www.aspspider.com/ is a great place to learn or to throw up something quickly and the toolset is fantastic given the price.
Highly recommended.
Binding to a Settings file
<ToggleButton x:Name="btnNetworkSpeed" Margin="5,0,0,0" FlowDirection="LeftToRight" IsChecked="{Binding Source={x:Static InfrastructureProperties:Settings.Default}, Path=IsSlowConnectionSpeed, Mode=TwoWay}" FontSize="9"/>
The trick to making this work is to change the settings file access modifier to Public. To do this go into the settings file and at the top of the designer there is a drop down. What this does under the covers is change the compile tool from 'SettingsSingleFileGenerator' to 'PublicSettingsSingleFileGenerator'
If you want the setting to be persisted on the closing event of the application add this line and you're done.
protected override void OnExit(ExitEventArgs e)
{
Modules.Infrastructure.Properties.Settings.Default.Save();
...
}
Insert binary data like images into SQL Server
In the below example I'm updating the an image column 'Icon' with an image file saved on the hard drive.
Update myTable
set Image = (
SELECT *
FROM OPENROWSET(BULK N'C:\image.png', SINGLE_BLOB) test)
where ImageID = 1
Bug in ItemsControl with nested bindings
After a lot of searching I found a few other people with the same problem but not many solutions. One workaround that seems to have been successful is to move the template into a resource. This didn't work for me but might be worth a try if you come across the same thing.
Workaround for bug in WPF Splash Screen
System.ComponentModel.Win32Exception was unhandled
Message="The operation completed successfully"
Source="WindowsBase"
ErrorCode=-2147467259
NativeErrorCode=0
StackTrace:
at MS.Win32.UnsafeNativeMethods.SetActiveWindow(HandleRef hWnd)
at System.Windows.SplashScreen.Close(TimeSpan fadeoutDuration)
at System.Windows.SplashScreen.
b__0(Object splashObj) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Qmastor.WinApp.PortManagement.Loader.App.Main() in C:\SourceCode\PitToPort\PortManagement\Qmastor.WinApp.PortManagement.Loader\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
The suggested solution on the connect website doesn't seem to work for me and I failed to find any other solutions on the net other than rolling your own splash screen. However I found that adding this line of code before closing the splash screen seems to fix the problem for me:
App.Current.MainWindow.Focus();
_splash.Close(TimeSpan.Zero);