Browse Source

Add possible null checks

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/wpfdesigner@6085 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Kumar Devvrat 16 years ago
parent
commit
54b533eacf
  1. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs

@ -126,8 +126,6 @@ namespace ICSharpCode.WpfDesign.Designer @@ -126,8 +126,6 @@ namespace ICSharpCode.WpfDesign.Designer
/// </summary>
public void UnloadDesigner()
{
if(_focusNav!=null)
_focusNav.End();
if (_designContext != null) {
foreach (object o in _designContext.Services.AllServices) {
IDisposable d = o as IDisposable;
@ -175,10 +173,12 @@ namespace ICSharpCode.WpfDesign.Designer @@ -175,10 +173,12 @@ namespace ICSharpCode.WpfDesign.Designer
public bool CanCopyOrCut()
{
ISelectionService selectionService = GetService<ISelectionService>();
if(selectionService!=null){
if (selectionService.SelectedItems.Count == 0)
return false;
if (selectionService.SelectedItems.Count == 1 && selectionService.PrimarySelection == DesignContext.RootItem)
return false;
}
return true;
}
@ -218,7 +218,7 @@ namespace ICSharpCode.WpfDesign.Designer @@ -218,7 +218,7 @@ namespace ICSharpCode.WpfDesign.Designer
public bool CanPaste()
{
ISelectionService selection = _designContext.Services.Selection;
if(selection.SelectedItems.Count!=0){
if(selection!=null && selection.SelectedItems.Count!=0){
string xaml = Clipboard.GetText(TextDataFormat.Xaml);
if(xaml != "" && xaml != " ")
return true;

Loading…
Cancel
Save