Esempio n. 1
0
 private void RefreshAsync()
 {
     m_dirty = false;
     new MethodInvoker(() =>
     {
         var layout = SettingsTable.Get <VoucherLayout>(Strings.VScan_VoucherLayout);
         if (layout != null)
         {
             this.InvokeSafe(new Action <VoucherLayout>((l) =>
             {
                 this.BackgroundImage = l.Background;
                 this.m_BarcodeArea   = l.BarcodeArea;
                 this.m_AreaToHide    = l.CardcodeArea;
                 this.m_PrintArea     = l.PrintArea;
             }), layout);
         }
         else
         {
             var file = ClientDataAccess.SelectFileMax();
             if (file != null)
             {
                 this.InvokeSafe(new MethodInvoker(() =>
                 {
                     Image image            = file.VoucherImage.ToImage();
                     this.BackgroundImage   = image;
                     this.AutoScrollMinSize = image.Size;
                 }));
             }
             else
             {
                 //Do not change this line
                 MessageBox.Show(
                     "Could not find any voucher into the database.\r\n" +
                     "Use 'Foad file' and load a sample image.", Application.ProductName,
                     MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
                       ).FireAndForget();
 }