aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml
blob: 95839453ab6f10a7e5f47e0da70fc47ef1ca336d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<UserControl x:Class="Tango.PPC.UI.Views.NoPermissionsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels"
             xmlns:global="clr-namespace:Tango.PPC.UI"
             xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
             xmlns:local="clr-namespace:Tango.PPC.UI.Views"
             mc:Ignorable="d" 
             d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:NoPermissionsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.NoPermissionsViewVM}">
    <Grid>
        <DockPanel Margin="20 60 20 20">
            <StackPanel DockPanel.Dock="Top">
                <Image Source="../Images/no-permissions.png" Width="256" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" HorizontalAlignment="Center"></Image>
                <TextBlock HorizontalAlignment="Center" Margin="0 40 0 0" FontSize="{StaticResource TangoHeaderFontSize}">No Application Modules Loaded</TextBlock>
                <TextBlock TextWrapping="Wrap" TextAlignment="Center" HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoTitleFontSize}">The current user does not seems to have a permission to load any of the application modules. Please contact your administrator.</TextBlock>
            </StackPanel>

            <Grid>
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320">
                    <touch:TouchButton Command="{Binding RestartCommand}" Padding="0 30" CornerRadius="40">RESTART</touch:TouchButton>
                </StackPanel>
            </Grid>
        </DockPanel>
    </Grid>
</UserControl>
>using System; using System.Drawing.Imaging; using System.IO; using System.Text; namespace Tango.Pulse { /// <summary> /// Represents a Pulse, twn file writer. /// </summary> public class TwnFileWriter { /// <summary> /// Writes the specified TWN file. /// </summary> /// <param name="twnFile">The TWN file.</param> /// <param name="output">The output.</param> /// <exception cref="System.ArgumentOutOfRangeException">Invalid design name length.</exception> /// <exception cref="System.NullReferenceException"> /// Thumbnail image is null. /// or /// Could not serialize a null embroidery file. /// </exception> /// <exception cref="System.ArgumentException">The embroidery format must contain exactly 3 characters.</exception> public void Write(TwnFile twnFile, Stream output) { BinaryWriter writer = new BinaryWriter(output); //Format Version (Default is 1.0). writer.Write(twnFile.Version); //The name of the design or other labeling information as UTF - 8 text padded with white spaces and limited to 50 bytes. byte[] nameBytes = Encoding.UTF8.GetBytes(twnFile.Name.PadRight(50, ' ')); if (nameBytes.Length < 50) { throw new ArgumentOutOfRangeException("Invalid design name length."); } writer.Write(nameBytes, 0, 50); //The embedded preview image size in byte length as a 32 bit unsigned integer. if (twnFile.Thumbnail == null) { throw new NullReferenceException("Thumbnail image is null."); } byte[] thumbnailBytes = null; //For later use. using (MemoryStream ms = new MemoryStream()) { twnFile.Thumbnail.Save(ms, ImageFormat.Png); writer.Write((UInt32)ms.Length); thumbnailBytes = ms.ToArray(); } //The total number of brush segments as a 32 bit unsigned integer. writer.Write((UInt32)twnFile.Segments.Count); //Number of copies. (The number 0 will be treated as 1, so the default is 0) writer.Write((UInt32)twnFile.NumberOfCopies); //0 - Spool per segment. (default) //1 - Spool per copy. //2 - Single spool for all segments. writer.Write((byte)twnFile.SpoolingMethod); //A unique code representing an optional media ID from Twine’s recommended media list. writer.Write((UInt32)twnFile.MediaID); //3 ASCII characters representing the embedded embroidery file extension (e.g dst, pes). if (twnFile.EmbroideryFileFormat.Length != 3) { throw new ArgumentException("The embroidery format must contain exactly 3 characters."); } writer.Write(Encoding.ASCII.GetBytes(twnFile.EmbroideryFileFormat)); //The byte array length of the embedded embroidery file. if (twnFile.EmbroideryFile == null) { throw new NullReferenceException("Could not serialize a null embroidery file."); } writer.Write((UInt32)twnFile.EmbroideryFile.Length); //Array of bytes representing the design preview image in PNG format(transparent background). //The size of the PNG byte array must be defined in the header. Recommended image width is 1280 //pixels while maintaining aspect ratio. writer.Write(thumbnailBytes); //Array of Brush Segment. The number of brush segments must be defined in the header. foreach (var segment in twnFile.Segments) { //Required thread length in centimeters. writer.Write(segment.Length); //Number of brush stops. writer.Write((UInt32)segment.BrushStops.Count); //Array of brush stops. foreach (var stop in segment.BrushStops) { //The RGB red component. writer.Write(stop.R); //The RGB green component. writer.Write(stop.G); //The RGB blue component. writer.Write(stop.B); //The Brush stop offset position within the parent brush length in percentage (0-1). writer.Write(stop.Offset); } } //Byte array representing the standard embroidery file which can be extracted and inserted into an embroidery machine. writer.Write(twnFile.EmbroideryFile); } } }