private void button1_Click(object sender, RoutedEventArgs e) { //エンティティをテーブルに1件追加 var l = System.Environment.TickCount; var constr = new Properties.Settings().StorageConnectionString; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(constr); // Create the table client. CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); // Create the CloudTable object that represents the "people" table. CloudTable table = tableClient.GetTableReference("people"); // Create a new customer entity. CustomerEntity customer1 = new CustomerEntity("Harp", "Walter" + _n); customer1.Email = "*****@*****.**"; customer1.PhoneNumber = "425-555-0101"; _n++; // Create the TableOperation object that inserts the customer entity. TableOperation insertOperation = TableOperation.Insert(customer1); // Execute the insert operation. table.Execute(insertOperation); Debug.WriteLine($"処理時間={(System.Environment.TickCount - l)}ms"); }
public bool MakeGETDownloadRequestToAws(bool useSSL, string bucketName, string keyName, string queryString) { var result = false; var mySettings = new Properties.Settings(); //create an instance of the REST class var myDownload = new SprightlySoftAWS.S3.Download(); // build the URL to call. The bucket name and key name must be empty to return all buckets RequestURL = myDownload.BuildS3RequestURL(useSSL, "s3.amazonaws.com", bucketName, keyName, queryString); RequestMethod = "GET"; ExtraRequestHeaders = new Dictionary<String, String> { { "x-amz-date", DateTime.UtcNow.ToString("r") }}; //add a date header //generate the authorization header value var authorizationValue = myDownload.GetS3AuthorizationValue(RequestURL, RequestMethod, ExtraRequestHeaders, "AKIAJCHWEMYQ5UXHOWSQ", "GLQ3fzqhpJmEvRf3J6SWquH1KbQdVEI+3tqqWGiy"); //add the authorization header if (!ExtraRequestHeaders.ContainsValue(authorizationValue)) { ExtraRequestHeaders.Add("Authorization", authorizationValue); } //call Download file to submit the download request result = myDownload.DownloadFile(RequestURL, RequestMethod, ExtraRequestHeaders, DownloadFileName, true); return result; }
private void button2_Click(object sender, RoutedEventArgs e) { // Create a new queue with custom settings. string connectionString = new Properties.Settings().ConnectionString; var l = System.Environment.TickCount; QueueClient Client = QueueClient.CreateFromConnectionString(connectionString, "TestQueue"); Client.Send(new BrokeredMessage()); for (int i = 0; i < 100; i++) { // Create message, passing a string message for the body. BrokeredMessage message = new BrokeredMessage("Test message " + i); // Set some addtional custom app-specific properties. message.Properties["TestProperty"] = "TestValue"; message.Properties["Message number"] = i; // Send message to the queue. Client.Send(message); } //処理時間=11469ms 100message Debug.WriteLine("処理時間=" + (Environment.TickCount - l)); }
/// <summary> /// Provied Textbox object to the constructor /// </summary> /// <param name="logTb"></param> /// public Log(ExRichTextBox logTb) { settings = Properties.Settings.Default; lockWriteLine = new object(); tb = logTb; tb.Clear(); }
//private const string USER_AGENT = "Mozilla/5.0 (X11; U; Linux x86_64; en_US; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8"; public Form1() { settings = new Properties.Settings(); settings.Reload(); InitializeComponent(); edtUsername.Text = settings.username; //edtPassword.Text = settings.password; if (settings.password != "") { UTF8Encoding encoding = new UTF8Encoding(); byte[] encPwd = Convert.FromBase64String(settings.password); //byte[] encPwd = encoding.GetBytes(settings.password); byte[] decPwd = {}; try { decPwd = ProtectedData.Unprotect(encPwd, additionalEntropy, DataProtectionScope.CurrentUser); } catch (CryptographicException e) { MessageBox.Show("Error decrypting user password. Defaulting to blank password."); //decPwd = encoding.GetBytes(""); //decPwd = {}; } edtPassword.Text = encoding.GetString(decPwd); } threadDelegate1 = new ThreadDelegate(updateProgress); threadDelegate2 = new ThreadDelegate2(updateStatus); keyHandled = false; this.KeyDown += Form1_KeyDown; this.KeyPress += Form1_KeyPress; }
private bool isFirstTimeLogin() { Properties.Settings stg = new Properties.Settings(); int t = int.Parse(stg.LoginTimes); return (t == 1); }
private void button2_Click(object sender, RoutedEventArgs e) { var constr = new Properties.Settings().StorageConnectionString; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(constr); // Create the queue client CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); // Retrieve a reference to a queue CloudQueue queue = queueClient.GetQueueReference("taikin"); // Get the next message CloudQueueMessage retrievedMessage = queue.GetMessage(); //Queueにはデータが入っていない。 if (retrievedMessage == null) { Console.WriteLine("データがみつかりません。"); return; } Console.WriteLine(retrievedMessage.AsString); //Process the message in less than 30 seconds, and then delete the message queue.DeleteMessage(retrievedMessage); }
private void btnSalvar_Click(object sender, EventArgs e) { ProGenes.Properties.Settings settings = new Properties.Settings(); SqlConnection conexao = new SqlConnection(settings.BancoDeDados); try { conexao.Open(); SqlCommand comando = conexao.CreateCommand(); comando.Connection = conexao; SqlTransaction transacao = conexao.BeginTransaction("IncluirTFA"); comando.Transaction = transacao; comando.CommandText = "INSERT INTO TFA(nomTFA,desTFA) VALUES (@nomeTabela,@descricaoTabela)"; comando.Parameters.Add(new SqlParameter("nomeTabela", txbNomeTFA.Text.Trim())); comando.Parameters.Add(new SqlParameter("descricaoTabela", txbNomeTFA.Text.Trim())); comando.ExecuteNonQuery(); transacao.Commit(); MessageBox.Show("Tabela Cadastrada com Sucesso!", "Informação"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Erro"); } finally { conexao.Close(); this.Close(); } }
public PollsMainForm(User _user) { InitializeComponent(); //_anketsUser=new User(); //_anketsUser.Login = "******"; //_anketsUser.CodMfo = 964; //_anketsUser.CodObl = 8; //_anketsUser.CodRKC = 0; //_anketsUser.PrivilegesCodMfo = 0; //_anketsUser.PrivilegesCodObl = 6; //_anketsUser.PrivilegesCodRKC = 0; //_anketsUser. _anketsUser = _user; _deposPollsTable = new DeposPollsTableForm(_anketsUser); splitContainer1.Panel2.Controls.Add(_deposPollsTable); _deposPollsTable.Dock = DockStyle.Fill; settings = global::Poll.Properties.Settings.Default; //Console.WriteLine(settings.Test); //settings.Test = "проверка"; //Console.WriteLine(settings.Test); //MessageBox.Show(settings.Test); OrderedDictionary ttt = new OrderedDictionary(); foreach (DataColumn t in _deposPollsTable.pollsDataSet.POLL_DEPOS.Columns) { ttt.Add(t.ColumnName, ""); //settings.DeposTableColumnsText.Add(t.ColumnName,""); } settings.DeposTableColumnsText = ttt; settings.Save(); //_deposPollsTable.buttonAddPoll. //Refresh(); Update(); }
private int increaseLoginTimes() { Properties.Settings stg = new Properties.Settings(); int t = int.Parse(stg.LoginTimes); stg.LoginTimes = (++t).ToString(); stg.Save(); return t; }
public MainDownloader(Initialize aboutus) { InitializeComponent(); config = Properties.Settings.Default; formAbout = aboutus; formRequest = new RequestBox(this); }
public static FileMgr getFileMgr() { if (_fileMgr == null) { Properties.Settings stg = new Properties.Settings(); _fileMgr = new FileMgr(stg.SyncFolder); } return _fileMgr; }
public CustomerFeedbackForm() { InitializeComponent(); appSettings = Properties.Settings.Default; rdoOptIn.Checked = appSettings.CustomerFeedbackOptIn; risData.Links.Add(0, risData.Text.Length, "http://www.runtimeintelligence.com/portal?CompanyID=3e35f098-ce43-4f82-9e9d-05c8b1046a45&ApplicationID=121959b2-80b3-482a-96d0-31249486bfbf"); }
private void button_Click(object sender, RoutedEventArgs e) { string connectionString = new Properties.Settings().ConnectionString; var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); if (!namespaceManager.TopicExists("TestTopic")) { namespaceManager.CreateTopic("TestTopic"); } }
public FrmContainer() { InitializeComponent(); foreach (Control c in this.Controls) { if (c is MdiClient) { c.BackColor = this.BackColor; c.BackgroundImage = this.BackgroundImage; } } _defaultSettings = Properties.Settings.Default; }
public SettingsForm(ref Properties.Settings settings) { InitializeComponent(); _settings = settings; oldLogin = textBox1.Text; oldPassword = textBox2.Text; oldToken = _settings.steamToken; //SetupHotkeyList(); //checkBoxHotKey.DataBindings.Add(new Binding("Checked", this, "WaitingHotKey", false, DataSourceUpdateMode.OnPropertyChanged, null)); if( settingsTree1.Nodes.Count > 0) settingsTree1.TreeView.SelectedNode = settingsTree1.Nodes[0]; }
public MainForm() { InitializeComponent(); settings = Properties.Settings.Default; if (Settings.Default.FirstTime) { UpgradeSettings(); } // could look in HKLM \ Software \ Toontrack \ Superior \ EZDrummer \ HomePath LoadSettings(); }
public bool UploadFile(string filePath, string uploadType) { var isUploaded = false; var mySettings = new Properties.Settings(); // apply the correct bucket #if DEBUG if (uploadType == "master") { BucketName = mySettings.MasterBucketNameTest; } else { BucketName = mySettings.UploadBucketNameTest; } #else if (uploadType == "master") { BucketName = mySettings.MasterBucketName; } else { BucketName = mySettings.UploadBucketName; } #endif if (string.IsNullOrEmpty(UploadFileName)) { UploadFileName = filePath; } try { // instantiate the upload class and make the call to upload the file var s3FileUpload = new AWSRequests(UploadFileName); isUploaded = s3FileUpload.MakePUTS3UploadRequestToAws(false, BucketName, FolderName); if (isUploaded) { File.Delete(filePath); } } catch (Exception ex) { util.ErrorNotification(ex); } return isUploaded; }
private void BugReportDialog_Load(object sender, EventArgs e) { Settings = Properties.Settings.Default; build = File.GetLastWriteTimeUtc(Application.ExecutablePath); BuildDate.Text = build.ToString(CultureInfo.InvariantCulture); t = DateTime.UtcNow; Time.Text = t.ToString(CultureInfo.InvariantCulture); OSVersion.Text = Environment.OSVersion.ToString(); if (string.IsNullOrEmpty(Settings.Username)) Username.Text = Environment.MachineName; else Username.Text = Settings.Username; Log.Text = (exception == null ? string.Empty : exception.ToString()); }
public bool MakePUTS3UploadRequestToAws(bool useSSL, string bucketName, string folderName) { var result = false; var mySettings = new Properties.Settings(); try { //create an instance of the REST class var myUpload = new SprightlySoftAWS.S3.Upload(); // build the URL to call. The bucket name and key name must be empty to return all buckets RequestURL = myUpload.BuildS3RequestURL(useSSL, "s3.amazonaws.com", bucketName, folderName + Path.GetFileName(UploadFileName), string.Empty); RequestMethod = "PUT"; //add a date header ExtraRequestHeaders = new Dictionary<String, String> { { "x-amz-date", DateTime.UtcNow.ToString("r") }}; //generate the authorization header value var authorizationValue = myUpload.GetS3AuthorizationValue(RequestURL, RequestMethod, ExtraRequestHeaders, mySettings.AWSAccessKeyId, mySettings.AWSSecretAccessKey); // add the public access permission header //ExtraRequestHeaders.Add("x-amz-acl", "public-read"); //add the authorization header ExtraRequestHeaders.Add("Authorization", authorizationValue); //call UploadFile to submit the upload request result = myUpload.UploadFile(RequestURL, RequestMethod, ExtraRequestHeaders, UploadFileName); var requestResult = myUpload.LogData; if (result) { util.LogMessage("UploadSuccess", requestResult); } else { util.LogMessage("UploadFailure", requestResult); } } catch (Exception ex) { util.ErrorNotification(ex); } return result; }
public DataBaseTrans() { try { this.conn = new MySqlConnection(); Properties.Settings objConf = new Properties.Settings(); this.conn.ConnectionString = objConf.universidadeConnectionString; objConf = null; this.conn.Open(); } catch (MySqlException e) { throw new Exception(e.ToString()); } }
private void tsbCount_Click(object sender, EventArgs e) { Datalayer d = Datalayer.Instance; try { Properties.Settings s = Properties.Settings.Default; statusLabel.Text = String.Format("Locations {0}", d.Open(s.OraUsername, s.OraPassword, s.OraTNS)); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void options_Click(object sender, EventArgs e) { OptionsForm frm = OptionsForm.Instance; IList <Camera> camCopy = new List <Camera>(); foreach (Camera item in Configuration.Instance.Cameras) { camCopy.Add(new Camera() { ID = item.ID, Name = item.Name, IpAddress = item.IpAddress, Mac = item.Mac, Status = item.Status }); } frm.Cameras = camCopy; if (frm.ShowDialog(this) == DialogResult.OK) { Properties.Settings setting = Properties.Settings.Default; Configuration.Instance.Cameras = frm.Cameras;//这里添加设置摄像机的 IP 和 ID 对应的设置类文件 ResetCameraInfo Configuration.Instance.Save(); //setting.Save(); InitStatusBar(); this.Cameras = frm.Cameras.ToArray <Camera>(); var minFaceWidth = int.Parse(setting.MinFaceWidth); float ratio = float.Parse(setting.MaxFaceWidth) / minFaceWidth; // SetupExtractor(setting.EnvMode, // float.Parse(setting.IconLeftExtRatio), // float.Parse(setting.IconRightExtRatio), // float.Parse(setting.IconTopExtRatio), // float.Parse(setting.IconBottomExtRatio), // minFaceWidth, // ratio, // new Rectangle(int.Parse(setting.SrchRegionLeft), // int.Parse(setting.SrchRegionTop), // int.Parse(setting.SrchRegionWidth), // int.Parse(setting.SrchRegionHeight)) // ); StartSetCam(setting); } }
/// <summary> /// Uruchomienie na bazie pewnej porcji pracy (NHUnitOfWork) /// </summary> /// <remarks> /// Metoda domyślnie może być wywołana tylko z parametrem work, wtedy zostanie automatycznie założona /// sesja i trnsakacja. /// Dodatkowo aby ułatwić testy można podać jako parametr własną sesję. Jeżeli zostanie podana własna sesja /// to w zależności czy jest w niej transakcja (raczej powinna już być) zostanie założona lub nie. /// /// </remarks> /// <param name="work">Zadania do wykonania</param> /// <param name="session">Opcjonalna sesja z trnskcją, jeżeli nie chcemy aby metoda założyła własną</param> public void ExecuteWork(IUnitOfWork work, ISession session = null) { INHUnitOfWork nhWork = work as INHUnitOfWork; if (nhWork == null) { throw new ArgumentException("Zadanie musi implementować INHUnitOfWork", "work"); } //licznik deadlocków, jak za dużo to się poddaję int deadlockCnt = 0; //skrót do konfiguracji Properties.Settings cfg = Properties.Settings.Default; //próbuję wykonać pracę, jeżęli wystąpi deadlock i jest to moja sesja... to //staram się ponowić N-razy pracę while (true) { try { TryExecuteWork(nhWork, session); return; } catch (GenericADOException e) { if (CurrenctDialectHelper.IsDeadlock(e) && session == null && deadlockCnt < cfg.MaxInterceptedDeadlocks) { Log.Warn("Deadlock intercepted: ", e); //1. Wystapił deadlock... //2. Jest to moja sesja więc mogę założyć ją od nowa, oraz transakcję //3. Nie wyczerpałem limitu przechwyceń... Random _r = new Random(); //usypiam na losowy czas, nie chcę 'atakować' bazy w pętli System.Threading.Thread.Sleep(_r.Next(cfg.MinDeadlockSleep, cfg.MaxDeadlockSleep)); deadlockCnt++; } else { Log.Error(e.Message, e); //Nie jest to deadlock, nie jest to moja sesja.. lub było ich za dużo throw; } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OKCommand_Executed(object sender, ExecutedRoutedEventArgs e) { Properties.Settings settings = Properties.Settings.Default; settings.App_Postgres_Host = this.WVM.Host; settings.App_Postgres_Port = this.WVM.Port; settings.App_Postgres_UserName = this.WVM.UserName; settings.App_Postgres_Password = this.passwordBox.Password; settings.App_Postgres_DatabaseName = this.WVM.DatabaseName; settings.App_Postgres_Role = this.WVM.Role; settings.App_Postgres_DumpExePath = this.WVM.DumpExePath; settings.App_Postgres_RestoreExePath = this.WVM.RestoreExePath; settings.Save(); this.DialogResult = true; this.Close(); }
public MainForm() { InitializeComponent(); if (!string.IsNullOrEmpty(Program.directory)) { this.Text += "-[" + Program.directory + "]"; } //config.GetLineCameras(); Properties.Settings setting = Properties.Settings.Default; InitStatusBar(); }
static void ReadSettings(Form form, Properties.Settings settings) { form.WindowState = settings.MainFormMaximized ? FormWindowState.Maximized : FormWindowState.Normal; var rect = new Rectangle(settings.MainFormLocation, settings.MainFormClientSize); if (Screen.AllScreens.Any(screen => screen.Bounds.IntersectsWith(rect))) { form.StartPosition = FormStartPosition.Manual; form.Location = rect.Location; form.ClientSize = rect.Size; } else { form.StartPosition = FormStartPosition.CenterScreen; } }
public void SetValues() { //Save Values Properties.Settings userSettings = Properties.Settings.Default; userSettings.Username = textBox_Username.Text; userSettings.Deck_Default = textBox_Deck.Text; userSettings.LoadPrevDeck = checkBox_PrevDeck.Checked; userSettings.AutoShuffle = checkBox_Shuffle.Checked; userSettings.MainSleeve = ImageConverter.ToString(mainDeck); userSettings.GSleeve = ImageConverter.ToString(GZone); userSettings.Playmat = ImageConverter.ToString(Playmat); userSettings.Save(); }
public void Load() { Properties.Settings set = Properties.Settings.Default; StartFromCharge = set.StartFromCharge; BattertyCapacity = set.BatteryCapacity; ChargeVoltage = set.ChargeVoltage; CurrentChargeStability = set.CurrentStabilityWnd; AfterChargeRelaxation = set.AftreChargeRelaxation; ChargeTimeout = set.ChargeTimeout; CurrentPercentLimit = set.CurrentPercentLimit; LowBatteryVoltageLimit = set.LowBatteryVoltageLimit; HighBatteryVoltageLimit = set.HighBatteryVoltageLimit; ChargeWhenComplete = set.ChargeWhenComplete; CyclesCount = set.CyclesCount; }
private void SaveUserSettings() { var userSettings = new Properties.Settings { KeyboardFormLocation = Location, KeyboardFormWidth = Width, KeyboardFormHasNumberPad = hasNumberPad, KeyboardFormHasMacKeyboard = isMacKeyboard, ColourMapFormOpen = FormsManager.IsColourMapFormOpen(), MappingListFormOpen = FormsManager.IsMappingListFormOpen(), UserHasSavedSettings = true }; // userSettings.KeyboardLayout = (int)AppController.KeyboardLayout; userSettings.Save(); }
public FileProcessor(string fileSystemPath, IEnumerable <FileExclusion> exclusions, Properties.Settings settings) { this.fileSystemPath = fileSystemPath; watcher = new FileWatcher(fileSystemPath); collector = new FileCollector(exclusions); compressor = new Compressor(settings.CompressionApplication, settings.FileCompressionCommandLineFormat, settings.FolderCompressionCommandLineFormat, settings.ArchiveExtension); this.settings = settings; collector.Added += (s, e) => FireChanged((ModelState)Math.Max((int)ModelState.FilesChanged, (int)State)); watcher.FileChanged += watcher_FileChanged; watcher.FileDeleted += watcher_FileDeleted; thread = new Thread(Run) { Name = "Compression loop" }; thread.Start(); }
private void Entrance_Click(object sender, EventArgs e) { Properties.Settings settings = Properties.Settings.Default; string connectionString = ConfigurationManager.ConnectionStrings["Connect"].ConnectionString; SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connectionString); builder.DataSource = settings.DataSource; builder.UserID = TextBoxLogin.Text; builder.Password = TextBoxPassword.Text; StringBuilder builderEntities = new StringBuilder(settings.StudentTestingEntities1); builderEntities.Replace("@login", builder.UserID); builderEntities.Replace("@password", builder.Password); builderEntities.Replace("@dataSource", settings.DataSource); builderEntities.Replace("@DataBase", settings.DataBase); settings.connectStudentTestingEntities = builderEntities.ToString(); settings.Save(); using (StudentTestingEntities1 db = new StudentTestingEntities1()) { DbConnection connection = db.Database.Connection; Exception error = null; try { connection.Open(); } catch (Exception ex) { error = ex;//Переменная error запоминает конкретную ошибку MessageBox.Show($"Error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (error == null) { connection.Close(); MessageBox.Show("Соединение установлено!", "Выполнено"); Main NewForm = new Main(); NewForm.Show(); this.Hide(); } } } }
static void Main(string[] Args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Add listeners System.Diagnostics.Trace.Listeners.Add(new System.Diagnostics.ConsoleTraceListener()); // Detect languages DetectSupportedLanguages(); // Load settings Settings = new Properties.Settings(); Settings.Reload(); // First run ? if (!Program.Settings.FirstRun) { FixFolders(); FixPalette(); ControlMappingSettings.BuildDefaultControlSettings(); try { FormFirstRun frm = new FormFirstRun(); frm.ShowDialog(); Program.Settings.FirstRun = true; } catch (Exception ex) { MMB.ManagedMessageBox.ShowErrorMessage(ex.Message); } } // Set language Language = Settings.Language; ResourceManager = new ResourceManager("MyNes.LanguageResources.Resource", Assembly.GetExecutingAssembly()); // Start-up nes emulation engine MyNes.Core.NesEmu.WarmUp(); // Create the main form FormMain = new FormMain(); // Do command lines DoCommandLines(Args); // Run ! Application.Run(FormMain); }
private void options_Click(object sender, EventArgs e) { using (OptionsForm frm = new OptionsForm()) { IList <Camera> camCopy = new List <Camera>(); foreach (Camera item in Configuration.Instance.Cameras) { camCopy.Add(new Camera() { ID = item.ID, Name = item.Name, IpAddress = item.IpAddress }); } frm.Cameras = camCopy; if (frm.ShowDialog(this) == DialogResult.OK) { Properties.Settings setting = Properties.Settings.Default; Configuration.Instance.Cameras = frm.Cameras; Configuration.Instance.Save(); setting.Save(); InitStatusBar(); this.Cameras = frm.Cameras.ToArray <Camera>(); var minFaceWidth = int.Parse(setting.MinFaceWidth); float ratio = float.Parse(setting.MaxFaceWidth) / minFaceWidth; SetupExtractor(setting.EnvMode, float.Parse(setting.IconLeftExtRatio), float.Parse(setting.IconRightExtRatio), float.Parse(setting.IconTopExtRatio), float.Parse(setting.IconBottomExtRatio), minFaceWidth, ratio, new Rectangle(int.Parse(setting.SrchRegionLeft), int.Parse(setting.SrchRegionTop), int.Parse(setting.SrchRegionWidth), int.Parse(setting.SrchRegionHeight)) ); } } }
/// <summary> /// Edit Application Config. /// </summary> public static void Perform(string Parameter, string Value) { // Create a new Instance of Application Setiings. Properties.Settings Config = new Properties.Settings(); if ((Parameter.ToLower() == "webserver")) { Config.WebServer = Value; } else { Config.MasterID = Value; } // Save Config. Config.Save(); // Restart Computer. Shutdown.Perform("restart", 0); }
public MainForm() { settings = Properties.Settings.Default; InitializeComponent(); statusBar.Text = "Disconnected"; try { client = new WebSocket(String.Format("ws://{0}:{1}/", host, port)); client.Error += new EventHandler<SuperSocket.ClientEngine.ErrorEventArgs>(client_Error); client.AllowUnstrustedCertificate = true; client.Opened += new EventHandler(client_Opened); client.Closed += new EventHandler(client_Closed); client.MessageReceived += new EventHandler<MessageReceivedEventArgs>(client_MessageReceived); client.Open(); } catch { } }
void SaveUserSettings() { Properties.Settings userSettings = new Properties.Settings { KeyboardFormLocation = this.Location, KeyboardFormWidth = this.Width, KeyboardFormHasNumberPad = this._hasNumberPad, KeyboardFormHasMacKeyboard = this._isMacKeyboard, ColourMapFormOpen = FormsManager.IsColourMapFormOpen(), MappingListFormOpen = FormsManager.IsMappingListFormOpen(), LastMappingsFilter = (int)MappingsManager.Filter, UserHasSavedSettings = true }; // userSettings.KeyboardLayout = (int)AppController.KeyboardLayout; userSettings.Save(); }
public override List <Association> GetAssociationList() { string sql = string.Empty; Properties.Settings config = new Properties.Settings(); if (config.Oracle_FKSql.Length > 0) { sql = config.Oracle_FKSql; } else { sql = @"SELECT UC.CONSTRAINT_NAME AS FOREIGNKEY, concat(concat(UC.owner,'.'), UC.TABLE_NAME) AS TABLENAME, UCC.COLUMN_NAME AS ColumnName, concat(concat(UC.owner,'.'), RT.TABLE_NAME) AS RELATEDTABLENAME, RTC.column_name AS RelatedColumnName FROM SYS.ALL_CONSTRAINTS UC, SYS.ALL_CONSTRAINTS RT, SYS.ALL_CONS_COLUMNS RTC, SYS.ALL_CONS_COLUMNS UCC WHERE UC.R_CONSTRAINT_NAME = RT.CONSTRAINT_NAME AND UC.R_OWNER = RT.OWNER AND UCC.constraint_name = UC.CONSTRAINT_NAME AND RTC.constraint_name = RT.CONSTRAINT_NAME AND (UC.CONSTRAINT_TYPE = 'R') AND (UC.OWNER in (select user from dual))"; } DataTable dataTable = this.GetDataTable(sql); List <Association> associations = new List <Association>(); associations.AddRange((from row in dataTable.AsEnumerable() select new Association { AssociationName = row.Field <string>("ForeignKey"), TableName = row.Field <string>("TableName"), ColumnName = row.Field <string>("ColumnName"), RelatedTableName = row.Field <string>("RelatedTableName"), RelatedColumnName = row.Field <string>("RelatedColumnName"), AssociationType = AssociationType.Item }).ToList()); this.AddAssociationListItems(associations); return(associations); }
/// <summary> /// Populates the GUI with values from database & computer. Sets selected items to the settings saved from the application. /// </summary> void PopulateGUI() { settingsVM = new SettingsViewModel(); settings = new Properties.Settings(); //set item sources comboCompanyAddress.ItemsSource = settingsVM.CompanyAddresses; comboPrinters.ItemsSource = settingsVM.InstalledPrinters; comboPrinters.Items.Refresh(); comboCompanyAddress.Items.Refresh(); //disable edit and delete shipFromBtn editShipFrBtn.IsEnabled = false; deleteShipFrBtn.IsEnabled = false; //load settings.printer as selected item if (settings.LabelPrinter != null) { //get index of the saved printer from ViewModel.Installedprinters int index = settingsVM.InstalledPrinters.IndexOf(settings.LabelPrinter); //set the above to the selected item in the comboBox for printers comboPrinters.SelectedIndex = index; } //load settings.companyAddress Id as the selected item if (settings.CompanyAddressId > 0) { //get the companyAddressModel from settingsViewModel where it's the same ID as the settings.CompAddressID int compId = settings.CompanyAddressId; int index = settingsVM.CompanyAddresses.FindIndex(c => c.Id == compId); //set the combo box to the result comboCompanyAddress.SelectedIndex = index; //call selected event to change it's value comboCompanyAddress_Selected(this.comboCompanyAddress, null); } if (settings.SaveFileDir != null) { string saveDir = settings.SaveFileDir; txtSaveLocation.Text = saveDir; } }
protected override void Initialize(Properties.Settings settings) { base.Initialize(settings); if (settings.FindPairSettings == null) { settings.FindPairSettings = new FindPairSettings(); } var s = settings.FindPairSettings; _rows = s.Rows; _columns = s.Columns; _images = s.Images; FillSamples(); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is DateTime dateTime) { Properties.Settings settings = App.Current.Resources["Settings"] as Properties.Settings; if (settings.App_IsDebug) { return(dateTime.ToString("yyyy/MM/dd HH:mm:ss")); } else { return(dateTime.ToString("yyyy年")); } } throw new NotImplementedException(); }
private void okButton_Click(object sender, EventArgs e) { // Should we store settings for the next time? if (rememberSettingsCheckBox.Checked) { // Get settings Properties.Settings settings = Properties.Settings.Default; // Store values settings.ContractSourceProject = cbContractProject.Text; settings.ProjectLocation = txtProjectLocation.Text; settings.BuildLocation = txtBinaryOutput.Text; // Save settings.Save(); } }
private void button1_Click(object sender, RoutedEventArgs e) { // Configure Topic Settings. TopicDescription td = new TopicDescription("TestTopic2"); td.MaxSizeInMegabytes = 5120; td.DefaultMessageTimeToLive = new TimeSpan(0, 1, 0); string connectionString = new Properties.Settings().ConnectionString; var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); if (!namespaceManager.TopicExists("TestTopic2")) { namespaceManager.CreateTopic(td); } }
private void LoadSettings() { ArrayList Ports = SerialPowerManagement.GetSerialPorts(); foreach (string p in Ports) Port.Items.Add(p); Properties.Settings settings = new Properties.Settings(); Port.SelectedItem = settings.Port; Baud.SelectedItem = settings.Baud; Parity.SelectedItem = settings.Parity; Stopbits.SelectedItem = settings.Stopbits; Databits.SelectedItem = settings.Databits; PowerOnString.Text = settings.PowerOnString; PowerOffString.Text = settings.PowerOffString; USBPowerOffString.Text = settings.USBUIRTOff; USBPowerOnString.Text = settings.USBUIRTOn; if (settings.UseWindowsPower) { UseWindowsPower.Checked = true; UseSerialPortPower.Checked = false; UseUSBUIRTPower.Checked = false; SerialPanel.Enabled = false; USBPanel.Enabled = false; } else if(settings.UseSerialPortPower) { UseWindowsPower.Checked = false; UseSerialPortPower.Checked = true; UseUSBUIRTPower.Checked = false; USBPanel.Enabled = false; SerialPanel.Enabled = true; } else if (settings.UseUSBUIRTPower) { UseWindowsPower.Checked = false; UseSerialPortPower.Checked = false; UseUSBUIRTPower.Checked = true; SerialPanel.Enabled = false; USBPanel.Enabled = true; } NetworkControl.Checked = settings.NetworkControl; }
public void Save() { Properties.Settings set = Properties.Settings.Default; set.StartFromCharge = StartFromCharge; set.BatteryCapacity = BattertyCapacity; set.ChargeVoltage = ChargeVoltage; set.CurrentStabilityWnd = CurrentChargeStability; set.AftreChargeRelaxation = AfterChargeRelaxation; set.ChargeTimeout = ChargeTimeout; set.CurrentPercentLimit = CurrentPercentLimit; set.LowBatteryVoltageLimit = LowBatteryVoltageLimit; set.HighBatteryVoltageLimit = HighBatteryVoltageLimit; set.ChargeWhenComplete = ChargeWhenComplete; set.CyclesCount = CyclesCount; set.Save(); }
/// <summary> /// 初始化. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UserControlClient_Load(object sender, EventArgs e) { // 取得配置信息. Properties.Settings config = Properties.Settings.Default; // IP地址. localAddr = IPAddress.Parse(config.IPAddress); // 接入点. ephost = new IPEndPoint(localAddr, config.Port); // 初始化 主线程方法. mainThreadStart = new ThreadStart(StartService); // 初始化时, 没有 号码. this.lblNumberInfo.Text = String.Empty; }
private void button1_Click(object sender, RoutedEventArgs e) { // Configure queue settings. QueueDescription qd = new QueueDescription("TestQueue"); qd.MaxSizeInMegabytes = 5120; qd.DefaultMessageTimeToLive = new TimeSpan(0, 1, 0); // Create a new queue with custom settings. string connectionString = new Properties.Settings().ConnectionString; var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); if (!namespaceManager.QueueExists("TestQueue")) { namespaceManager.CreateQueue(qd); } }
public MainForm() { settings = new Properties.Settings(); settings.Reload(); InitializeComponent(); Size = settings.WindowSize; Location = settings.WindowPosition; WindowState = settings.WindowState; ConfigureCodeEditor(); codeText.Text = settings.Code; plotTimer.Interval = 33; compileScript(); }
private void button1_Click(object sender, RoutedEventArgs e) { var constr = new Properties.Settings().StorageConnectionString; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(constr); // Create the queue client. CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); // Retrieve a reference to a queue. CloudQueue queue = queueClient.GetQueueReference("taikin"); // Create the queue if it doesn't already exist. queue.CreateIfNotExists(); // Create a message and add it to the queue. CloudQueueMessage message = new CloudQueueMessage("Hello, World" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); queue.AddMessage(message); }
private void button_Click(object sender, RoutedEventArgs e) { var constr = new Properties.Settings().StorageConnectionString; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(constr); var l = System.Environment.TickCount; // Create a CloudFileClient object for credentialed access to File storage. CloudFileClient fileClient = storageAccount.CreateCloudFileClient(); // Get a reference to the file share we created previously. CloudFileShare share = fileClient.GetShareReference("logs"); // Ensure that the share exists. if (share.Exists()) { // Get a reference to the root directory for the share. CloudFileDirectory rootDir = share.GetRootDirectoryReference(); // Get a reference to the directory we created previously. CloudFileDirectory sampleDir = rootDir.GetDirectoryReference("CustomLogs"); // Ensure that the directory exists. if (sampleDir.Exists()) { // Get a reference to the file we created previously. CloudFile file = sampleDir.GetFileReference("20140510_154631.mp4"); // Ensure that the file exists. if (file.Exists()) { // Write the contents of the file to the console window. //Console.WriteLine(file.DownloadTextAsync().Result); var task = file.DownloadToFileAsync(@"d:\a.mp4",System.IO.FileMode.CreateNew); task.Wait(); } } } //処理時間=5500 20MB Debug.WriteLine("処理時間=" + (System.Environment.TickCount - l)); }
/// <summary> /// Load the user login settings. /// </summary> private void LoadSettings() { Properties.Settings props = Properties.Settings.Default; this.fUrlTextbox.Text = props.URL; this.fAuthenticationModeComboBox.SelectedItem = AuthenticationMode.CWSAuthentication; try { this.fAuthenticationModeComboBox.SelectedItem = Enum.Parse(typeof(AuthenticationMode), props.AuthenticationMethod); } catch (ArgumentException) { } this.fRCSAuthURLTextBox.Text = props.RCSAuthURL; this.fUserNameTextbox.Text = props.UserName; this.fPasswordTextbox.Text = Util.Decrypt(props.Password); }
private void loadAccountInfo() { Properties.Settings stg = new Properties.Settings(); if (string.IsNullOrEmpty(stg.Account)) { txbPassword.Text = ""; txbUserName.Text = ""; } else { string[] ss = stg.Account.Split('|'); string acnt = ss[0]; string pswd = ss[1]; txbUserName.Text = EncryptionHelper.DESDecode(acnt, "yuexiuCloud"); txbPassword.Text = EncryptionHelper.DESDecode(pswd, acnt); ckbRememberAccount.Checked = true; } }
public void WriteTo(Properties.Settings settings, ConfigReader reader) { settings.DisplayName = RememberMe ? DisplayName : String.Empty; settings.DisplayMessage = RememberMe ? DisplayMessage : String.Empty; settings.DisplayImage = RememberMe ? DisplayImage : null; settings.GroupName = RememberMe ? GroupName : String.Empty; settings.EmailAddress = RememberMe ? EmailAddress : String.Empty; settings.Username = RememberMe ? Username : String.Empty; settings.Password = ProtectedData.Protect(RememberMe ? Password : String.Empty); settings.Domain = RememberMe ? Domain : String.Empty; reader.SetSetting(SettingKey.AutoSignIn, AutoSignMeIn); reader.SetSetting(SettingKey.IdleTimeout, IdleTimeout); settings.FontColor = FontColor; settings.FontStyle = FontStyle; settings.FontSize = FontSize; settings.FontName = FontName; }
public static void ShowEditMappingForm(KeyMapping km, bool useCapture) { AddEditMapping mf = new AddEditMapping(km, useCapture); Properties.Settings userSettings = new Properties.Settings(); Point savedLocation = userSettings.EditMappingFormLocation; if (savedLocation.IsEmpty == false) { mf.Location = savedLocation; } else { PositionChildForm(mf, ChildFormPosition.MiddleLeft); } mf.ShowDialog(_mainForm); }
protected override void Initialize(Properties.Settings settings) { base.Initialize(settings); if (settings.TableSummationModelSettings == null) { settings.TableSummationModelSettings = new TableSummationModelSettings(); } var s = settings.TableSummationModelSettings; _summationMode = s.Operation; _firstNumberFrom = s.FirstNumberFrom; _firstNumberTo = s.FirstNumberTo; _secondNumberFrom = s.SecondNumberFrom; _secondNumberTo = s.SecondNumberTo; FillSamples(); }
private bool?GetVisibility(Properties.Settings settings, Link link, Flat flat) { bool?result = null; if (settings.FilterByAddress) { var address = link.Text.Trim(); result = SearchContext.Current.Data.GetVisbility(address); if (result.HasValue && !result.Value) { return(result); } } if (settings.FilterByFlat && flat != null) { result = flat.Visible; } return(result); }
public static void OpenChildForms() { Properties.Settings userSettings = new Properties.Settings(); if (userSettings.ColourMapFormOpen) { ToggleColourMapForm(); } if (userSettings.MappingListFormOpen) { ToggleMappingListForm(); } if (userSettings.ShowHelpFormAtStartup) { ShowHelpForm(); } }
private static void Main() { if (AppController.IsOnlyAppInstance() == false) { return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += ApplicationThreadException; AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; AppController.CreateAppDirectory(); #if DEBUG #else Console.Write("Redirecting console output"); LogProvider.RedirectConsoleOutput(); #endif ConfigFileProvider.ValidateUserConfigFile(); Properties.Settings userSettings = new Properties.Settings(); if (userSettings.UpgradeRequired) { Console.WriteLine("Upgrading settings to new version"); userSettings.Upgrade(); userSettings.UpgradeRequired = false; userSettings.Save(); } AppController.Start(); Application.Run(new KeyboardForm()); AppController.Close(); // Release static events or else leak. Application.ThreadException -= ApplicationThreadException; AppDomain.CurrentDomain.UnhandledException -= UnhandledExceptionHandler; }
private static void _SaveGA(string username, string password) { if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password)) { try { Properties.Settings settings = Properties.Settings.Default; settings.GlobalAccountUsername = username; settings.GlobalAccountPassword = StringProcessor.TransformData( password); settings.Save(); } catch (Exception e) { Logger.Error(e); } } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// private static NetworkCredential _LoadGA() { Properties.Settings settings = Properties.Settings.Default; string username = settings.GlobalAccountUsername; string password = settings.GlobalAccountPassword; NetworkCredential credentials = null; if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password)) { var passwordValue = default(string); if (StringProcessor.TryTransformDataBack(password, out passwordValue)) { credentials = new NetworkCredential(username, passwordValue); } } return(credentials); }