Skip to content

Commit

Permalink
Can now has printing
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtobin committed Jan 6, 2012
1 parent a46d255 commit 576a18e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/MarkPad/Document/DocumentView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@
</avalonedit:TextEditor.Effect>
</avalonedit:TextEditor>

<awe:WebControl UseLayoutRounding="True" Margin="10,10,10,-5" Grid.Column="1" HorizontalAlignment="Stretch" shared:WebBrowserUtility.BindableContent="{Binding Render}">
<awe:WebControl x:Name ="WebControl" UseLayoutRounding="True" Margin="10,10,10,-5" Grid.Column="1" HorizontalAlignment="Stretch" shared:WebBrowserUtility.BindableContent="{Binding Render}">
<awe:WebControl.Effect>
<DropShadowEffect BlurRadius="10" Color="Black" Opacity="0.25" Direction="270" />
</awe:WebControl.Effect>
Expand Down
9 changes: 9 additions & 0 deletions src/MarkPad/Document/DocumentViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,14 @@ public override void CanClose(System.Action<bool> callback)

callback(result);
}

public void Print()
{
var view = this.GetView() as DocumentView;
if(view != null)
{
view.WebControl.Print();
}
}
}
}
1 change: 1 addition & 0 deletions src/MarkPad/Shell/ShellView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<Button x:Name="OpenDocument" Content="OPEN" Style="{DynamicResource ChromelessButtonStyle}" FontSize="13.333" Margin="0,0,20,0" FontWeight="Bold" />
<Button x:Name="SaveDocument" Content="SAVE" Style="{DynamicResource ChromelessButtonStyle}" FontSize="13.333" Margin="0,0,20,0" FontWeight="Bold" />
<Button x:Name="SaveAllDocuments" Content="SAVE ALL" Style="{DynamicResource ChromelessButtonStyle}" FontSize="13.333" Margin="0,0,20,0" FontWeight="Bold" />
<Button x:Name="PrintDocument" Content="PRINT" Style="{DynamicResource ChromelessButtonStyle}" FontSize="13.333" Margin="0,0,20,0" FontWeight="Bold" />
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10" Orientation="Horizontal">
<Button Click="ButtonMinimiseOnClick" Style="{DynamicResource ChromelessButtonStyle}" Content="0" FontFamily="Marlett" />
Expand Down
9 changes: 9 additions & 0 deletions src/MarkPad/Shell/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,14 @@ public void SaveAllDocuments()
doc.Save();
}
}

public void PrintDocument()
{
var doc = MDI.ActiveItem as DocumentViewModel;
if (doc != null)
{
doc.Print();
}
}
}
}

0 comments on commit 576a18e

Please sign in to comment.