<EmbeddedResource Include="Images\Icons\member.svg" />
<EmbeddedResource Include="Images\Icons\exit2.svg" />
<EmbeddedResource Include="Images\button.svg" />
- <EmbeddedResource Include="Images\Icons\iconInfo.svg" />
+ <EmbeddedResource Include="Images\Icons\iconInfo.svg">
+ <LogicalName>Crow.Images.Icons.Informations.svg</LogicalName>
+ </EmbeddedResource>
<EmbeddedResource Include="Templates\tmpDirItem.goml" />
<EmbeddedResource Include="Templates\ScrollingListBox.goml" />
<EmbeddedResource Include="Templates\imgItemTemplate.goml" />
MouseEnter="./onBorderMouseEnter"
MouseLeave="./onBorderMouseLeave">
<VerticalStack Background="{./Background}">
- <Border BorderWidth="0" Foreground="White" Height="Fit"
+ <Border BorderWidth="0" Foreground="White" Height="Fit" Width="Stretched" MinimumSize="200,0"
Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">
<HorizontalStack Name="hs" Margin="2" Spacing="1" Height="Fit" >
<GraphicObject Width="5" Height="5"/>
<Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
<Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" />
- <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
+ <Border CornerRadius="3" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
<Image Focusable="true" Name="Image" Path="#Crow.Images.Icons.exit2.svg"
MouseClick="./butQuitPress"/>
</HorizontalStack>
</Border>
<HorizontalStack Margin="5">
- <Image Name="Image" Width="20%" Height="20" Path="#Crow.Images.Icons.iconInfo.svg" />
- <Label Margin="5" Font="serif, 10" Width="80%" Text="{./Message}"
+ <Image Name="Image" Width="20%" Height="30" Path="{./MsgIcon}" />
+ <Label Margin="5" Font="{./Font}" Width="Fit" Text="{./Message}"
TextAlignment="Left"
Multiline="true" />
</HorizontalStack>
<HorizontalStack Margin="1" Spacing="0" Height="Fit" Width="60%" HorizontalAlignment="Right">
- <Button Width="50%" Caption="Ok" MouseClick="./onOkButtonClick" />
- <Button Width="50%" Caption="Cancel" MouseClick="./onCancelButtonClick" />
+ <Button Width="50%" Caption="{./OkMessage}" MouseClick="./onOkButtonClick" />
+ <Button Width="50%" Caption="{./CancelMessage}" MouseClick="./onCancelButtonClick" />
</HorizontalStack>
</VerticalStack>
</Border>
{
public class MessageBox : Window
{
- public MessageBox ():base(){}
+ public enum Type {
+ Information,
+ YesNo,
+ Alert,
+ Error
+ }
+ public MessageBox (): base(){}
- string message;
+ protected override void loadTemplate (GraphicObject template)
+ {
+ base.loadTemplate (template);
+ NotifyValueChanged ("MsgIcon", "#Crow.Images.Icons.Informations.svg");
+ }
+ string message, okMessage, cancelMessage;
+ Type msgType = Type.Information;
public event EventHandler Ok;
public event EventHandler Cancel;
NotifyValueChanged ("Message", message);
}
}
-
+ [XmlAttributeAttribute][DefaultValue("Ok")]
+ public virtual string OkMessage
+ {
+ get { return okMessage; }
+ set {
+ if (okMessage == value)
+ return;
+ okMessage = value;
+ NotifyValueChanged ("OkMessage", okMessage);
+ }
+ }
+ [XmlAttributeAttribute][DefaultValue("Cancel")]
+ public virtual string CancelMessage
+ {
+ get { return cancelMessage; }
+ set {
+ if (cancelMessage == value)
+ return;
+ cancelMessage = value;
+ NotifyValueChanged ("CancelMessage", cancelMessage);
+ }
+ }
+ [XmlAttributeAttribute][DefaultValue("Information")]
+ public virtual Type MsgType
+ {
+ get { return msgType; }
+ set {
+ if (msgType == value)
+ return;
+ msgType = value;
+ NotifyValueChanged ("MsgType", msgType);
+ switch (msgType) {
+ case Type.Information:
+ NotifyValueChanged ("MsgIcon", "#Crow.Images.Icons.Informations.svg");
+ Caption = "Informations";
+ OkMessage = "Ok";
+ CancelMessage = "Cancel";
+ break;
+ case Type.YesNo:
+ NotifyValueChanged ("MsgIcon", "#Crow.Icons.question.svg");
+ Caption = "Choice";
+ OkMessage = "Yes";
+ CancelMessage = "No";
+ break;
+ case Type.Alert:
+ NotifyValueChanged ("MsgIcon", "#Crow.Images.Icons.IconAlerte.svg");
+ Caption = "Alert";
+ OkMessage = "Ok";
+ CancelMessage = "Cancel";
+ break;
+ case Type.Error:
+ NotifyValueChanged ("MsgIcon", "#Crow.Images.Icons.exit.svg");
+ Caption = "Error";
+ OkMessage = "Ok";
+ CancelMessage = "Cancel";
+ break;
+ }
+ }
+ }
void onOkButtonClick (object sender, EventArgs e)
{
Ok.Raise (this, null);
{
Cancel.Raise (this, null);
}
-
+ public static MessageBox Show (Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){
+ lock (Interface.CurrentInterface.UpdateMutex) {
+ MessageBox mb = new MessageBox ();
+ mb.Initialize ();
+ mb.CurrentInterface.AddWidget (mb);
+ mb.MsgType = msgBoxType;
+ mb.Message = message;
+ if (!string.IsNullOrEmpty(okMsg))
+ mb.OkMessage = okMsg;
+ if (!string.IsNullOrEmpty(cancelMsg))
+ mb.CancelMessage = cancelMsg;
+ return mb;
+ }
+ }
}
}