コード例 #1
0
 public MainWindow()
 {
     InitializeComponent();
     lblVersion.Content          = string.Format("Version: {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
     santaSack                   = SantaSackSerializer.Deserialize();
     lstParticipants.ItemsSource = from participant in santaSack.Participants select participant.DisplayValue();
 }
コード例 #2
0
 public MainWindow()
 {
     InitializeComponent();
     lblVersion.Content = string.Format("Version: {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
     santaSack = SantaSackSerializer.Deserialize();
     lstParticipants.ItemsSource = from participant in santaSack.Participants select participant.DisplayValue();
 }
コード例 #3
0
 public static void Serialize(SantaSack santaSack)
 {
     IFormatter formatter = new BinaryFormatter();
     var path = Directory.GetParent(System.AppDomain.CurrentDomain.BaseDirectory).FullName + @"\SantaSack.bin";
     Stream stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
     formatter.Serialize(stream, santaSack);
     stream.Close();
 }
コード例 #4
0
        public static void Serialize(SantaSack santaSack)
        {
            IFormatter formatter = new BinaryFormatter();
            var        path      = Directory.GetParent(System.AppDomain.CurrentDomain.BaseDirectory).FullName + @"\SantaSack.bin";
            Stream     stream    = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);

            formatter.Serialize(stream, santaSack);
            stream.Close();
        }
コード例 #5
0
 public SendDetails(ref SantaSack santaSack)
 {
     this.santaSack = santaSack;
     InitializeComponent();
     txtSMTP.Text = santaSack.Template.Host;
     txtPort.Text = santaSack.Template.Port;
     txtFrom.Text = santaSack.Template.FromAddress;
     txtSubject.Text = santaSack.Template.Subject;
     txtContent.Text = santaSack.Template.Content;
     txtDiagnostic.Text = santaSack.Template.DiagnosticDeliveryAddress;
     btnDone.IsEnabled = true;
 }
コード例 #6
0
 public SendDetails(ref SantaSack santaSack)
 {
     this.santaSack = santaSack;
     InitializeComponent();
     txtSMTP.Text            = santaSack.Template.Host;
     txtPort.Text            = santaSack.Template.Port;
     txtFrom.Text            = santaSack.Template.FromAddress;
     txtSubject.Text         = santaSack.Template.Subject;
     txtContent.Text         = santaSack.Template.Content;
     txtDiagnostic.Text      = santaSack.Template.DiagnosticDeliveryAddress;
     enableSSL.IsChecked     = santaSack.Template.EnableSsl;
     txtBlindCarbonCopy.Text = santaSack.Template.BlindCarbonCopy;
     txtFrom_Pass.Password   = santaSack.Template.FromPassword;
     btnDone.IsEnabled       = true;
 }
コード例 #7
0
 public SendDetails(ref SantaSack santaSack)
 {
     this.santaSack = santaSack;
     InitializeComponent();
     txtSMTP.Text = santaSack.Template.Host;
     txtPort.Text = santaSack.Template.Port;
     txtFrom.Text = santaSack.Template.FromAddress;
     txtSubject.Text = santaSack.Template.Subject;
     txtContent.Text = santaSack.Template.Content;
     txtDiagnostic.Text = santaSack.Template.DiagnosticDeliveryAddress;
     enableSSL.IsChecked = santaSack.Template.EnableSsl;
     txtBlindCarbonCopy.Text = santaSack.Template.BlindCarbonCopy;
     txtFrom_Pass.Password = santaSack.Template.FromPassword;
     btnDone.IsEnabled = true;
 }
コード例 #8
0
        public static SantaSack Deserialize()
        {
            SantaSack  santaSack;
            IFormatter formatter = new BinaryFormatter();
            var        path      = Directory.GetParent(System.AppDomain.CurrentDomain.BaseDirectory).FullName + @"\SantaSack.bin";

            if (File.Exists(path))
            {
                Stream stream = new FileStream(path,
                                               FileMode.Open,
                                               FileAccess.Read,
                                               FileShare.Read);
                santaSack = (SantaSack)formatter.Deserialize(stream);
                stream.Close();
            }
            else
            {
                santaSack = new SantaSack();
            }

            return(santaSack);
        }
コード例 #9
0
        public static SantaSack Deserialize()
        {
            SantaSack santaSack;
            IFormatter formatter = new BinaryFormatter();
            var path = Directory.GetParent(System.AppDomain.CurrentDomain.BaseDirectory).FullName + @"\SantaSack.bin";

            if (File.Exists(path))
            {
                Stream stream = new FileStream(path,
                                               FileMode.Open,
                                               FileAccess.Read,
                                               FileShare.Read);
                santaSack = (SantaSack)formatter.Deserialize(stream);
                stream.Close();
            }
            else
            {
                santaSack = new SantaSack();
            }

            return santaSack;
        }