Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            //Setting defaults
            cbFonts.DropDownItems.FindAndClick((ri) =>
            {
                return(string.CompareOrdinal((((KeyValuePair <FontFamily, FontStyle>)ri.Tag).Key).Name,
                                             SettingsTable.Get(Strings.VScan_DefaultFontFamily, "Arial")) == 0);
            });

            btnForeColor.PerformClick();

            lstColors.Buttons.FindAndClick((ri) =>
            {
                return(((Color)ri.Tag) == SettingsTable.Get(Strings.VScan_DefaultForeColor, Color.Black));
            });

            btnBackColor.PerformClick();

            lstColors.Buttons.FindAndClick((ri) =>
            {
                return(((Color)ri.Tag) == SettingsTable.Get(Strings.VScan_DefaultBackColor, Color.Black));
            });

            cbFondSize.DropDownItems.FindAndClick((ri) =>
            {
                return(ri.Tag.Cast <int>() == SettingsTable.Get(Strings.VScan_DefaultFontSize, 10));
            });

            btnLineSize.DropDownItems.FindAndClick((ri) =>
            {
                return(ri.Tag.Cast <int>() == SettingsTable.Get(Strings.VScan_DefaultLineSize, 3));
            });

            base.OnLoad(e);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Used to find and cover the cardcode by using the barcode location
        /// </summary>
        /// <returns></returns>
        public static VoucherProcessDelegate CreateHideCardDetailsDelegateByBarcode()
        {
            var method = new VoucherProcessDelegate((Voucher data, StateObj state) =>
            {
                var distanceToHiddenArea = SettingsTable.Get <Point>(Strings.VScan_DistanceFromBarcodeBottomLeftToHiddenArea, Point.Empty);
                if (distanceToHiddenArea == Point.Empty)
                {
                    var ex = new ApplicationException("Cannot find chunk configuration.");
                    ex.AddNext(new MethodInvoker(() =>
                    {
                        string id    = Strings.VScan_EditItem.Uniqueue();
                        data.Message = ex.Message;
                        DataSlot.Set(id, data);
                        WinMsg.SendText(state.Scan, state.Main, id);
                    }));
                    throw ex;
                }

                Size hideAreaSize        = SettingsTable.Get <Size>(Strings.VScan_HiddenAreaSize, Size.Empty);
                Point hiddenAreaLocation = new Point(data.BarCodeArea.Left, data.BarCodeArea.Bottom);

                hiddenAreaLocation.Offset(distanceToHiddenArea);
                Rectangle hiddenArea = new Rectangle(hiddenAreaLocation, hideAreaSize);

                var hiddenAreaDraw = SettingsTable.Get <HiddenAreaDrawingCfg>(Strings.VScan_HiddenAreaDrawingCfg, HiddenAreaDrawingCfg.Default);

                using (var g = Graphics.FromImage(data.VoucherImage))
                    g.FillRectangleHatch(hiddenArea, hiddenAreaDraw.ForeColor, hiddenAreaDraw.BackColor, hiddenAreaDraw.Style);
            });

            return(method);
        }
Exemplo n.º 3
0
        private void PreparePrinterComboBox()
        {
            string defaultPrinterName = PrintManager.GetDefaultPrinterName();
            string applicationPrinter = SettingsTable.Get(Strings.VScan_ApplicationPrinterName, defaultPrinterName);

            this.cbPrinters.SelectedIndexChanged -= new System.EventHandler(this.Printers_SelectedIndexChanged);

            this.cbPrinters.Clear();

            foreach (string printer in PrintManager.GetInstalledPrinters())
            {
                int index = cbPrinters.Items.Add(printer);

                if (string.Equals(printer, applicationPrinter) && string.Equals(printer, defaultPrinterName))
                {
                    cbPrinters.SelectedIndex = index;
                    cbPrinters.SetItemColor(index, Color.Green);
                }
                else if (string.Equals(printer, applicationPrinter))
                {
                    //Application Printer
                    cbPrinters.SelectedIndex = index;
                    cbPrinters.SetItemColor(index, Color.Blue);
                }
                else if (string.Equals(printer, defaultPrinterName))
                {
                    //Default printer
                    cbPrinters.SetItemColor(index, Color.Red);
                }
            }

            this.cbPrinters.SelectedIndexChanged += new System.EventHandler(this.Printers_SelectedIndexChanged);
        }
Exemplo n.º 4
0
        /// <summary>
        /// reload
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ReloadServer_Click(object sender, EventArgs e)
        {
            var url      = SettingsTable.Get <string>(Strings.All_CentralServerUrl, Strings.All_CentralServerUrlPathDefault);
            var authUser = SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject);

            DataServiceClient.CallSendCmd("reload");
        }
Exemplo n.º 5
0
        /// <summary>
        /// Used to find and cover the card code by a mark on the voucher image
        /// </summary>
        /// <returns></returns>
        public static VoucherProcessDelegate CreateHideCardDetailsDelegateByMark()
        {
            var method = new VoucherProcessDelegate((Voucher data, StateObj state) =>
            {
                var markArea = SettingsTable.Get <MarkAreaCfg>(Strings.VScan_MarkAreaConfiguration, MarkAreaCfg.Empty);

                if (markArea.Equals(MarkAreaCfg.Empty))
                {
                    var ex = new ApplicationException("Cannot find 'hide area' configuration.");
                    ex.AddNext(new MethodInvoker(() =>
                    {
                        string id    = Strings.VScan_EditItem.Uniqueue();
                        data.Message = ex.Message;
                        DataSlot.Set(id, data);
                        WinMsg.SendText(state.Scan, state.Main, id);
                    }));
                    throw ex;
                }

                Rectangle hiddenArea;

                using (var bmp2 = data.VoucherImage.ToBlackWhite(markArea.BlackWhiteThreshold))
                    hiddenArea = bmp2.FindRectangle(Point.Empty, markArea.BackColor, markArea.MinAreaSize, markArea.MaxAreaSize, markArea.Threshold);

                var hiddenAreaDraw = SettingsTable.Get <HiddenAreaDrawingCfg>(Strings.VScan_DistanceFromBarcodeBottomLeftToHiddenArea, HiddenAreaDrawingCfg.Default);

                using (var g = Graphics.FromImage(data.VoucherImage))
                    g.FillRectangleHatch(hiddenArea, hiddenAreaDraw.ForeColor, hiddenAreaDraw.BackColor, hiddenAreaDraw.Style);
            });

            return(method);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Used to print over the voucher image
        /// </summary>
        /// <returns></returns>
        public static VoucherProcessDelegate CreatePrintOnImageDelegate()
        {
            var method = new VoucherProcessDelegate((Voucher data, StateObj state) =>
            {
                var printLocation = SettingsTable.Get <Point>(Strings.VScan_PrintAreaLocation, Point.Empty);
                if (printLocation == Point.Empty)
                {
                    var ex = new ApplicationException("Cannot find 'print on image' configuration.");
                    ex.AddNext(new MethodInvoker(() =>
                    {
                        string id    = Strings.VScan_EditItem.Uniqueue();
                        data.Message = ex.Message;
                        DataSlot.Set(id, data);
                        WinMsg.SendText(state.Scan, state.Main, id);
                    }));
                    throw ex;
                }

                var aliases           = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
                aliases["[DATE]"]     = new Func <string>(() => DateTime.Now.ToString());
                aliases["[OPERATOR]"] = new Func <string>(() => SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject, UserAuth.Default).Name);
                aliases["[PCNAME]"]   = new Func <string>(() => PTFUtils.GetMachine());
                aliases["[SITEID]"]   = new Func <string>(() => data.SiteCode);
                aliases["[NUMBER]"]   = new Func <string>(() => Convert.ToString(SettingsTable.Get <int>(Strings.VScan_ScanCount, 0)));

                string voucherTemplate = SettingsTable.Get <string>(Strings.VScan_ImPrinterTemplate, Strings.VScan_ImPrinterTemplateDefault);
                string voucherText     = voucherTemplate.format(aliases);

                using (var g = Graphics.FromImage(data.VoucherImage))
                    g.DrawString(voucherText, SystemFonts.CaptionFont, Brushes.Red, printLocation);
            });

            return(method);
        }
Exemplo n.º 7
0
        protected override void OnLoad(EventArgs e)
        {
            string url = SettingsTable.Get <string>(Strings.VScan_TRS_UrlAddress, Strings.VScan_TRS_UrlAddressDefault);

            this.webBrowser1.Url = new System.Uri(url, System.UriKind.Absolute);
            base.OnLoad(e);
        }
Exemplo n.º 8
0
        public ScanForm(IntPtr mainForm)
        {
            this.components = new System.ComponentModel.Container();
            InitializeComponent();
            ms_Current = this;
            this.Text  = Application.ProductName.concat("-Scanner");

            bool defaultScanner         = SettingsTable.Get <bool>(Strings.VScan_TWAINUseDefaultScanner, false);
            bool defaultScannerSettings = SettingsTable.Get <bool>(Strings.VScan_TWAINUseDefaultScannerSettings, false);

            this.ShowIcon      = true;
            this.ShowInTaskbar = true;

            m_MainFormHandler = mainForm;

            m_twain          = new Twain();
            m_twain.MainForm = mainForm;
            m_twain.ScanForm = this.Handle;
            m_twain.Form     = this;
            m_twain.Init(this.Handle);

            if (defaultScanner)
            {
                var name = SettingsTable.Get <string>(Strings.VScan_ScannerName, Strings.VScan_DefaultScannerName);
                m_twain.Select(name);
            }

            AcquireVoucher(defaultScannerSettings);
        }
Exemplo n.º 9
0
        /// <summary>
        /// enable_client
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EnableClient_Click(object sender, EventArgs e)
        {
            var url      = SettingsTable.Get <string>(Strings.All_CentralServerUrl, Strings.All_CentralServerUrlPathDefault);
            var authUser = SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject);

            DataServiceClient.CallSendCmd("enable_client", new object[] { 1, false });
        }
Exemplo n.º 10
0
 private PasswordForm()
 {
     InitializeComponent();
     ShowCountries           = false;
     CountryID               = SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject, UserAuth.Default).CountryID;
     tbUserName.TextChanged += new EventHandler(TextBox_TextChanged);
     tbPassword.TextChanged += new EventHandler(TextBox_TextChanged);
 }
Exemplo n.º 11
0
 static ScanForm()
 {
     ms_Aliases["[DATE]"]     = new Func <string>(() => DateTime.Now.ToString());
     ms_Aliases["[OPERATOR]"] = new Func <string>(() => SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject, UserAuth.Default).Name);
     ms_Aliases["[PCNAME]"]   = new Func <string>(() => PTFUtils.GetMachine());
     ms_Aliases["[SITEID]"]   = new Func <string>(() => { Debug.Assert(ms_Current != null && ms_Current.VoucherData != null); return(ms_Current.VoucherData.SiteCode); });
     ms_Aliases["[NUMBER]"]   = new Func <string>(() => Convert.ToString(SettingsTable.Get <int>(Strings.VScan_ScanCount, 0)));
 }
Exemplo n.º 12
0
        /// <summary>
        /// Queries all site codes for user's country or for selected by Id country
        /// </summary>
        /// <param name="countryId"></param>
        /// <returns></returns>
        public static string[] QueryCountryCodes(int?countryId)
        {
            UserAuth auth  = SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject, UserAuth.Default);
            var      url   = SettingsTable.Get <string>(Strings.All_CentralServerUrl, Strings.All_CentralServerUrlPathDefault);
            var      codes = DataServiceClient.CallQueryContries(auth).ConvertAll <CountryData, string>(c => c.ShortName).ToArray();

            return(codes);
        }
Exemplo n.º 13
0
        private bool ChangePasswordInternal(Form owner)
        {
            var authUser = new UserAuth(CountryID, UserName, Password, IsInAdminContext);

            //Validate on TRS server
            DataServiceClient.CallValidateUser(authUser.CountryID, authUser.Name, authUser.Password);
            SettingsTable.Set(Strings.Transferring_AuthObject, authUser);
            SettingsTable.Get <UniqueList <UserAuth> >(Strings.Transferring_AuthObjectList).Add(authUser);
            return(true);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Creates SelectAuditIds reloading delegate
        /// </summary>
        /// <returns></returns>
        public static Delegate CreateAuditIdReloadDelegate()
        {
            var method = new Action(() =>
            {
                int minimumAuditIdsInCache = SettingsTable.Get <int>(Strings.VScan_MinimumAuditIDsInCache, Program.ITEMS_IN_CACHE);
                AuditIDSTable.AddRange(ClientDataAccess.SelectAvailableSiteCodeIDs(minimumAuditIdsInCache), minimumAuditIdsInCache);
            });

            return(method);
        }
Exemplo n.º 15
0
        public async Task ArchiveChannel(ISocketMessageChannel channel, [Remainder] string title)
        {
            var messages = await channel.GetMessagesAsync().Flatten();

            using (ChannelArchive archive = new ChannelArchive(title))
            {
                string voteEmote = _settings.Has("brackeys-emote") ? _settings.Get("brackeys-emote").Split(':').First() : string.Empty;

                foreach (IMessage msg in messages)
                {
                    ArchiveMessage             archiveMessage = new ArchiveEventSubmission(msg, voteEmote);
                    IEnumerable <ArchiveImage> archiveImages  = archiveMessage.GetMessageImages();

                    archive.AddMessage(archiveMessage);
                    foreach (ArchiveImage image in archiveImages)
                    {
                        archive.AddImage(image);
                    }
                }

                archive.CloseArchive();
                string zippedArchive = archive.ZipArchive();

                WeTransferClient wt = new WeTransferClient(BrackeysBot.Configuration["wetransfer-api-key"]);
                // Make sure we are authorized
                await wt.Authorize();

                var fileInfo = new System.IO.FileInfo(zippedArchive);
                // Create Partial File Information so WeTransfer knows how many files
                // you're going to upload, the names of those files and their sizes
                PartialFileInfo[] partialFileInfos = new PartialFileInfo[]
                {
                    new PartialFileInfo
                    {
                        Name = fileInfo.Name,
                        Path = fileInfo.FullName,
                        Size = (int)fileInfo.Length
                    }
                };

                // Create a File Transfer which informs WeTransfer that you're about to upload files
                // The second parameter is the transfer message which will show on the download page
                FileTransferResponse response = await wt.CreateTransfer(partialFileInfos, $"Download the archived channel #{channel.Name}!");

                // Now you can upload the files!
                // The first parameter is the transfer's ID
                await wt.Upload(response.ID, response.Files);

                // Now you need to tell WeTransfer that your files have been uploaded
                FileUploadResult result = await wt.FinalizeUpload(response.ID, response.Files);

                // FileUploadResult contains the url to the download page and the date of the expiry

                StringBuilder reply = new StringBuilder()
                                      .AppendLine($"I archived the channel <#{channel.Id}> for you{(title == channel.Name ? "!" : $", under the name **{title}**!")}")
Exemplo n.º 16
0
 private void Group3_Click(object sender, EventArgs e)
 {
     if (sender == btnNew3)
     {
         New();
     }
     else if (sender == btnOpen3)
     {
         ActiveChild.Open();
     }
     else if (sender == btnSave3)
     {
         ActiveChild.Save();
     }
     else if (sender == btnSaveAs3)
     {
         ActiveChild.SaveAs();
     }
     else if (sender == btnPrepare3)
     {
         new AppInfoException("Prepare not completed yet").ThrowAndForget();
     }
     else if (sender == btnPublish3)
     {
         new AppInfoException("Publish not completed yet").ThrowAndForget();
     }
     else if (sender == btnSend3)
     {
         string to      = SettingsTable.Get <string>(Strings.VScan_Email_To, "*****@*****.**");
         string subject = SettingsTable.Get <string>(Strings.VScan_Email_Subject, "VScan issue");
         string body    = SettingsTable.Get <string>(Strings.VScan_Email_Body, "Dear Support");
         Process.Start(new ProcessStartInfo(string.Format("mailto:{0}?subject={1}&body={2}", to, subject, body)));
     }
     else if (sender == btnClose3)
     {
         Close();
     }
     else if (sender == btnQuickPrint3)//print
     {
         ActiveChild.Print();
     }
     else if (sender == btnAdvancePrint3)// set printer
     {
         ActiveChild.SetupAndPrint();
     }
     else if (sender == btnPrintPreview3)//preview
     {
         ActiveChild.PrintPreview();
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Exemplo n.º 17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 /// <exception cref="QueueIsEmptyException"></exception>
 public static Voucher FillFromScanContext(Voucher data)
 {
     lock (data)
     {
         var currentScan = ScanAppContext.Default.CurrentScan;
         data.SiteCode         = AuditIDSTable.SelectRemoveFirstOrEmpty().ThrowIfDefault <string, NoDataIdException>();
         data.Comment          = currentScan.Comment;
         data.CompressionLevel = SettingsTable.Get <long>(Strings.VScan_CompressionLevel, Consts.DEFAULTCOMPRESSIONLEVEL);
         return(data);
     }
 }
Exemplo n.º 18
0
        private void PopulateCountiesComboBox()
        {
            var countries = SettingsTable.Get <DbCountry[]>(Strings.VScan_SelectDbCountries, null);

            cbCountries.DataSource            = countries;
            cbCountries.SelectedIndexChanged += new EventHandler(Countries_SelectedIndexChanged);
            if (cbCountries.Items.Count > 0)
            {
                cbCountries.SelectedIndex = 0;
            }
        }
Exemplo n.º 19
0
        private void BindSettingsComboBox()
        {
            var settings = SettingsTable.Default.GetSettingNames();

            cbAvailableSettings.Items.Clear();
            cbAvailableSettings.Items.AddRange(settings.ToArray());
            cbAvailableSettings.SelectedItem = SettingsTable.Get <string>(Strings.VScan_DefaultSettingsName);
            int index = cbAvailableSettings.SelectedIndex;

            cbAvailableSettings.SetItemColor(index, Color.Green);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Used to cut borders of the image
        /// </summary>
        /// <returns></returns>
        public static VoucherProcessDelegate CreateRepaireImageDelegate()
        {
            var method = new VoucherProcessDelegate((Voucher data, StateObj state) =>
            {
                Color color = SettingsTable.Get <Color>(Strings.VScan_ImageBorderColor, Color.White);
                const int COLOR_DISTANCE = 40;
                int colorDistance        = SettingsTable.Get <int>(Strings.VScan_ImageBorderColorDistance, COLOR_DISTANCE);
                data.VoucherImage        = data.VoucherImage.RemoveBorder(color, colorDistance);
            });

            return(method);
        }
Exemplo n.º 21
0
        public void Read()
        {
            ptbScanner.Text      = SettingsTable.Get <string>(Strings.VScan_ScannerName, Strings.VScan_DefaultScannerName);
            ptbWebTracerUrl.Text = SettingsTable.Get <string>(Strings.VScan_WebTracerUrl,
                                                              Strings.VScan_WebTracerUrlDefault);

            string url = SettingsTable.Get <string>(Strings.VScan_TRS_UrlAddress, Strings.VScan_TRS_UrlAddressDefault);

            ptbTRSURL.Text = url;

            PreparePrinterComboBox();
            PrepareScannerComboBox();
        }
Exemplo n.º 22
0
        private void AcquireVoucher(bool defaultScannerSettings)
        {
            bool   useImprinter = SettingsTable.Get <bool>(Strings.VScan_UseImPrinter, false);
            string voucherText  = null;

            if (useImprinter)
            {
                VoucherData = ScanAppContext.FillFromScanContext(new Voucher());
                string voucherTemplate = SettingsTable.Get <string>(Strings.VScan_ImPrinterTemplate, Strings.VScan_ImPrinterTemplateDefault);
                voucherText = voucherTemplate.format(ms_Aliases);
            }
            m_twain.Acquire(defaultScannerSettings, voucherText);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Used to clean up the system when job is node
        /// </summary>
        /// <returns></returns>
        public static VoucherProcessDelegate CreateEndScanDelegate()
        {
            var method = new VoucherProcessDelegate((Voucher data, StateObj state) =>
            {
                DelegateUtils.CreateAuditIdReloadDelegate().FireAndForget();
                int number = SettingsTable.Get <int>(Strings.VScan_ScanCount, 0);
                SettingsTable.Set(Strings.VScan_ScanCount, number + 1);
                TimeSpan cleanTime = SettingsTable.Get <TimeSpan>(Strings.VScan_SleepBeforeCleanTime, TimeSpan.FromSeconds(15));
                Thread.Sleep(cleanTime);
                //Do clean up here
            });

            return(method);
        }
Exemplo n.º 24
0
 public static void QueryCountryesAsync()
 {
     new MethodInvoker(() =>
     {
         UserAuth auth = SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject, UserAuth.Default);
         var url       = SettingsTable.Get <string>(Strings.All_CentralServerUrl, Strings.All_CentralServerUrlPathDefault);
         var countryes = DataServiceClient.CallQueryContries(auth).
                         ConvertAll <CountryData, DbCountry>(cd => new DbCountry()
         {
             CountryId = cd.CountryId, Name = cd.Name, ShortName = cd.ShortName
         }).ToArray();
         SettingsTable.Set(Strings.VScan_SelectDbCountries, countryes);
     }).FireAndForget();
 }
Exemplo n.º 25
0
        public void UpdateEnvironment()
        {
            DBConfigValue.Save(Strings.Transferring_SettingsObject,
                               new SettingsObj()
            {
                ConnectionString = ClientDataAccess.ConnectionString,
                CentralServerUrl = SettingsTable.Get <string>(Strings.All_CentralServerUrl, Strings.All_CentralServerUrlPathDefault),
                SendInterval     = SettingsTable.Get <int>(Strings.VScan_TranfSendInterval, 1),
                KeepHistoryDays  = SettingsTable.Get <int>(Strings.VScan_KeepHistoryDays, 1),
            });

            this.ShowWarning("When change scanner settings\r\n" +
                             "you may need to restart scanner as well");
        }
Exemplo n.º 26
0
        public CanvasControl()
        {
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.Dock      = DockStyle.Top;
            this.AllowDrop = true;

            LineSize   = 3;
            BrushNum   = 2;
            EraserSize = new Size(10, 10);

            Data.CompressionLevel = SettingsTable.Get <long>(Strings.VScan_CompressionLevel, Consts.DEFAULTCOMPRESSIONLEVEL);
        }
Exemplo n.º 27
0
        public void UpdateEnvironment()
        {
            var settingsObj = new SettingsObj()
            {
                ConnectionString = builder.ConnectionString,
                CentralServerUrl = ptbRemoteSrvURL.Text,
                SendInterval     = int.Parse(ptbSendInterval.Text),
                KeepHistoryDays  = SettingsTable.Get <int>(Strings.VScan_KeepHistoryDays, 1),
            };

            SettingsTable.Set(Strings.Transferring_SettingsObject, settingsObj);
            DBConfigValue.Save(Strings.Transferring_SettingsObject, settingsObj);

            SettingsTable.Default.Save();
        }
Exemplo n.º 28
0
        public async Task InitializeGiveaway([Remainder] string message)
        {
            // Delete the invokation message
            await Context.Message.DeleteAsync();

            // Reply with the specified message
            var botMessage = await ReplyAsync(message);

            // Find the giveaway emote and add it as a reaction
            var emote = _settings.Get(GIVEAWAY_EMOTE_IDENTIFIER);
            await botMessage.AddReactionAsync(new Emoji(emote));

            // Save the giveaway message id
            string identifier = $"{botMessage.Channel.Id}/{botMessage.Id.ToString()}";

            if (!_settings.Has(GIVEAWAY_MESSAGE_IDENTIFIER))
            {
                _settings.Add(GIVEAWAY_MESSAGE_IDENTIFIER, identifier);
            }
            else
            {
                _settings.Set(GIVEAWAY_MESSAGE_IDENTIFIER, identifier);
            }
        }
Exemplo n.º 29
0
        private void PrepareScannerComboBox()
        {
            var scannerName = SettingsTable.Get <string>(Strings.VScan_ScannerName, Strings.VScan_DefaultScannerName);

            //this.cbScanners.SelectedIndexChanged -= new System.EventHandler(this.Scanners_SelectedIndexChanged);

            this.cbScanners.Clear();

            foreach (var scanner in ScannerInfo.SelectInstalled())
            {
                int index = cbScanners.Items.Add(scanner);
            }

            this.cbScanners.SelectedItem = scannerName;
            //this.cbScanners.SelectedIndexChanged += new System.EventHandler(this.Scanners_SelectedIndexChanged);
        }
Exemplo n.º 30
0
 protected override void OnLoad(EventArgs e)
 {
     if (cbCountries.Visible)
     {
         var countries = SettingsTable.Get <DbCountry[]>(Strings.VScan_SelectDbCountries,
                                                         new DbCountry[] { new DbCountry()
                                                                           {
                                                                               CountryId = 826, ShortName = "UK"
                                                                           } }).ToList().
                         ConvertAll <tmpCountry>((c) => { return(new tmpCountry(c.ShortName, c.CountryId)); });
         cbCountries.DataSource            = countries;
         cbCountries.SelectedItem          = countries.FirstOrDefault((c) => c.Id == CountryID);
         cbCountries.SelectedIndexChanged += new EventHandler(Countries_SelectedIndexChanged);
     }
     base.OnLoad(e);
 }