private void ChargerXML() { FileStream flux = null; try { ImportDialog.ShowDialog(); if (!string.IsNullOrWhiteSpace(ImportDialog.FileName)) { using (flux = (FileStream)ImportDialog.OpenFile()) { listeArmes = ArmesBLL.GetInstance().Importer(flux); } Grille(); MessageBox.Show("Objets importés"); } ImportDialog.Reset(); } catch (ApplicationException e) { MessageBox.Show("Erreur lors du Chargement" + e.Message); } if (grilleArmes.CurrentRow.DataBoundItem != null) { AffichageArme((Arme)grilleArmes.CurrentRow.DataBoundItem); } //label1.Text = liste[0].Nom; }
//----------------------------------------------------------------------------- private void button1_Click(object sender, EventArgs e) { DialogResult result = ImportDialog.ShowDialog(); // Show the dialog. if (result == DialogResult.OK) // Test result. { m_filepath = ImportDialog.FileName; if (m_filepath.Contains(".txt")) { m_locations.Clear(); readTrackedLocations(m_filepath, ref m_locations); m_trackPoints.Clear(); for (int iNum = 0; iNum < m_locations.Count; ++iNum) { m_trackPoints.Add(new PointLatLng(m_locations[iNum], m_locations[iNum + 1])); iNum++; } MessageBox.Show("Tracking locations read sucessfully!", "Successfull!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Invalid File Format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void DeserializeNode(object sender, ExecutedRoutedEventArgs e) { var menuInfo = ValidateMenuInfo(sender); if (menuInfo == null) { return; } try { var imo = new ImportDialog(); if (imo.ShowModal() == true) { if (!string.IsNullOrWhiteSpace(imo.File) && System.IO.File.Exists(imo.File)) { UmbracoApplicationContext.Current.DeserializeNode(menuInfo.NodeType, menuInfo.NodeId, imo.File); } } } catch (Exception ex) { MessageBox.Show("An error occured: " + ex.Message); } }
private void importAssetMenuItem_Click(object sender, EventArgs e) { // Show Import Dialog ImportDialog dialog = new ImportDialog(); dialog.Icon = Icon; dialog.ShowDialog(); if (dialog.Cancelled) { return; } // Create new asset element with given name AssetElement ae = new AssetElement(); ae.FromXml(dialog.Asset.ToXml()); // Add asset to selected model TreeNode modelNode = mainTreeView.SelectedNode; ModelComponent model = ((ModelForm)mainTreeView.SelectedNode.Tag).Model; model.Assets.Add(ae); // Refresh to add node UpdateModelNode(model, modelNode.Parent); }
private void ImportAudiobook() { ImportDialog dialog = new ImportDialog(Page); if (dialog.ShowDialog() == true) { } }
public void FromVegas(Vegas vegas) { Config config = Config.Load(); ImportDialog importDialog = new ImportDialog(config, delegate { Import(config, vegas); }); importDialog.ShowDialog(); config.Save(); }
private void Import() { var manager = new ImportManager { SetWaiting = status => Waiting = status }; var dialog = new ImportDialog(manager); dialog.Show(); }
public void ImportData(object sender, ExecutedRoutedEventArgs e) { var menuInfo = ValidateMenuInfo(sender); if (menuInfo == null) { return; } try { using (var repository = DataConnectionHelper.CreateRepository(menuInfo.DatabaseInfo)) { var generator = DataConnectionHelper.CreateGenerator(repository, menuInfo.DatabaseInfo.DatabaseType); var imo = new ImportDialog { SampleHeader = generator.GenerateTableColumns(menuInfo.Name), Separator = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator.ToCharArray()[0] }; if (imo.ShowModal() != true) { return; } if (string.IsNullOrWhiteSpace(imo.File) || !System.IO.File.Exists(imo.File)) { return; } using (var reader = new CsvReader(imo.File, Encoding.UTF8)) { reader.ValueSeparator = imo.Separator; var hr = reader.ReadHeaderRecord(); if (generator.ValidColumns(menuInfo.Name, hr.Values)) { var i = 1; foreach (var record in reader.DataRecords) { generator.GenerateTableInsert(menuInfo.Name, hr.Values, record.Values, i); i++; } } } OpenSqlEditorToolWindow(menuInfo, generator.GeneratedScript); DataConnectionHelper.LogUsage("TableImport"); } } catch (System.IO.IOException iox) { EnvDteHelper.ShowError(iox.Message); } catch (Exception ex) { DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType, false); } }
/// <summary> /// Creates the new weather information collection. /// </summary> /// <returns></returns> public async Task <WeatherInfoCollection> CreateNewWeatherInfoCollection() { this.ImportDialog = new ImportDialog(); var dialogComplete = await this.ImportDialog.StartDialog(); if (dialogComplete) { this.NewWeatherInfoCollection = await this.getData(); } return(this.NewWeatherInfoCollection); }
private void _mergeButton_Click(object sender, EventArgs e) { ImportDialog.InitialDirectory = RConfig.Instance.LineageDirectory; ImportDialog.FileName = selectedComboName.Substring(0, selectedComboName.LastIndexOf(".")); ImportDialog.Filter = "Tab-SeparatedValues files (*.tsv)|*.tsv"; ImportDialog.FilterIndex = 1; ImportDialog.RestoreDirectory = true; if (ImportDialog.ShowDialog() == DialogResult.OK) { MergeForm f = new MergeForm(DatInfo); f.readSecond(ImportDialog.FileName); f.ShowDialog(this); } }
private void btnImport_Click(object sender, EventArgs e) { var dialog = new ImportDialog(_unitOfWork, _model); var check = dialog.ShowDialog(); if (check.Equals(DialogResult.OK)) { MessageBox.Show("Nhập hàng thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadItemData(); this.SearchItem(); this.LoadGridItem(_selectedIndex); this.LoadModel(_model); } dialog.Dispose(); }
public override void Execute(params object[] args) { using (var dialog = new ImportDialog()) { if (dialog.ShowDialog(owner) != DialogResult.OK) { return; } if (dialog.WordFile) { ImportWord(dialog.FilePath, dialog.AppendToPage); } else { ImportPowerPoint(dialog.FilePath, dialog.AppendToPage, dialog.CreateSection); } } }
public void ImportData(object sender, ExecutedRoutedEventArgs e) { var menuInfo = ValidateMenuInfo(sender); if (menuInfo != null) { try { using (IRepository repository = RepoHelper.CreateRepository(menuInfo.Connectionstring)) { var generator = RepoHelper.CreateGenerator(repository, string.Empty); ImportDialog imo = new ImportDialog(); imo.SampleHeader = generator.GenerateTableColumns(menuInfo.Name); imo.Separator = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator.ToCharArray()[0]; imo.Owner = Application.Current.MainWindow; if (imo.ShowDialog() == true) { using (var reader = new CsvReader(imo.File, System.Text.Encoding.UTF8)) { reader.ValueSeparator = imo.Separator; HeaderRecord hr = reader.ReadHeaderRecord(); if (generator.ValidColumns(menuInfo.Name, hr.Values)) { int i = 1; foreach (DataRecord record in reader.DataRecords) { generator.GenerateTableInsert(menuInfo.Name, hr.Values, record.Values, i); i++; } } } OpenSqlEditorToolWindow(menuInfo, generator.GeneratedScript); } } } catch (Exception ex) { MessageBox.Show(DataConnectionHelper.ShowErrors(ex)); } } }
private void ImportConfig_Click(object sender, EventArgs e) { String PresetTitle = ""; try { if (ImportDialog.ShowDialog() == DialogResult.OK) { foreach (string x in File.ReadLines(ImportDialog.FileName, Encoding.UTF8)) { try { // Title if (SettingName(x) == "ConfName") { PresetTitle = SettingValue(x); } // Banks else if (SettingName(x) == "BC1") { BC1.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC2") { BC2.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC3") { BC3.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC4") { BC4.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC5") { BC5.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC6") { BC6.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC7") { BC7.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC8") { BC8.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC9") { BC9.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BCD") { BCD.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC11") { BC11.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC12") { BC12.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC13") { BC13.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC14") { BC14.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC15") { BC15.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "BC16") { BC16.Value = Convert.ToInt32(SettingValue(x)); } // Presets else if (SettingName(x) == "PC1") { PC1.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC2") { PC2.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC3") { PC3.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC4") { PC4.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC5") { PC5.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC6") { PC6.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC7") { PC7.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC8") { PC8.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC9") { PC9.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PCD") { PCD.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC11") { PC11.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC12") { PC12.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC13") { PC13.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC14") { PC14.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC15") { PC15.Value = Convert.ToInt32(SettingValue(x)); } else if (SettingName(x) == "PC16") { PC16.Value = Convert.ToInt32(SettingValue(x)); } } catch (Exception ex) { MessageBox.Show( "Fatal error", String.Format("Invalid preset!\n\nException:\n{0}", ex.ToString()), MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } } MessageBox.Show( String.Format("The setting file \"{0}\" has been applied.", PresetTitle), "Keppy's Synthesizer - Import settings", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { // Something bad happened hehe MessageBox.Show( "Fatal error", String.Format("Fatal error during the execution of the program.\n\nPress OK to quit.\n\nException:\n{0}", ex.ToString()), MessageBoxButtons.OK, MessageBoxIcon.Error ); Application.Exit(); } }
private void tsbImport_Click(object sender, EventArgs e) { ImportDialog id = new ImportDialog(); id.ShowDialog(); }
// XML импорт сцены из файла private void ImportScene_Click(object sender, EventArgs e) { if (ImportDialog.ShowDialog() == DialogResult.OK) { try { IFormatProvider format = new System.Globalization.CultureInfo("en-us"); XDocument document = XDocument.Load(ImportDialog.FileName); XElement scene = document.Element("scene"); var mode = scene.Attribute("ViewMode").Value; if (mode == "WIREFRAME") { Scene.Mode = (Scene.MODE.WIREFRAME); ViewType.SelectedIndex = 0; } else { Scene.Mode = (Scene.MODE.SOLID); ViewType.SelectedIndex = 1; } Scene.Camera = new Camera(); Scene.ResetCamera(); var cameraElement = scene.Element("camera"); Scene.Camera.IsCentralProjection = bool.Parse(cameraElement.Element("central-projection").Value); XElement position = cameraElement.Element("position"); Scene.Camera.Position = new Point3DSpherical(new Point3D( double.Parse(position.Attribute("x").Value, format), double.Parse(position.Attribute("y").Value, format), double.Parse(position.Attribute("z").Value, format) )); XElement target = cameraElement.Element("target"); Scene.Camera.Target = new Point3DSpherical(new Point3D( double.Parse(target.Attribute("x").Value, format), double.Parse(target.Attribute("y").Value, format), double.Parse(target.Attribute("z").Value, format) )); Scene.Camera.MoveCameraLeftRight(0); Scene.Camera.MoveCameraUpDown(0); var lightElement = scene.Element("light"); XElement lightPosition = lightElement.Element("position"); Scene.Light.X = double.Parse(lightPosition.Attribute("x").Value, format); Scene.Light.Y = double.Parse(lightPosition.Attribute("y").Value, format); Scene.Light.Z = double.Parse(lightPosition.Attribute("z").Value, format); Scene.Objects.Clear(); ObjectsList.Items.Clear(); ObjectViewPanel.Visible = ObjectViewPanel.Enabled = ObjectSpacePanel.Visible = ObjectSpacePanel.Enabled = false; foreach (XElement objectElement in scene.Element("objects").Elements("Telescope")) { var radioName = objectElement.Attribute("name").Value; var tel = new TelescopeObject(radioName); XElement objectPosition = objectElement.Element("position"); tel.BasePoint = new Point3D( double.Parse(objectPosition.Attribute("x").Value, format), double.Parse(objectPosition.Attribute("y").Value, format), double.Parse(objectPosition.Attribute("z").Value, format) ); XElement rotate = objectElement.Element("rotate"); tel.AngleX = int.Parse(rotate.Attribute("x").Value); tel.AngleY = int.Parse(rotate.Attribute("y").Value); tel.AngleZ = int.Parse(rotate.Attribute("z").Value); XElement scale = objectElement.Element("scale"); tel.SetScale( double.Parse(scale.Attribute("x").Value, format), double.Parse(scale.Attribute("y").Value, format), double.Parse(scale.Attribute("z").Value, format) ); tel.Basis1CylinderRadius = double.Parse(objectElement.Element("Basis1CylinderRadius").Value, format); tel.PrimaryLegsLength = double.Parse(objectElement.Element("PrimaryLegsLength").Value, format); tel.Basis2CylinderRadius = double.Parse(objectElement.Element("Basis2CylinderRadius").Value, format); tel.Basis3CylinderRadius = double.Parse(objectElement.Element("Basis3CylinderRadius").Value, format); tel.LenseRadius = double.Parse(objectElement.Element("LenseRadius").Value, format); tel.SecondaryLegsLength = double.Parse(objectElement.Element("SecondaryLegsLength").Value, format); tel.PrimaryLegsCount = double.Parse(objectElement.Element("PrimaryLegsCount").Value, format); tel.SecondaryLegsCount = double.Parse(objectElement.Element("SecondaryLegsCount").Value, format); tel.HandsCount = int.Parse(objectElement.Element("HandsCount").Value, format); tel.HandsRadius = int.Parse(objectElement.Element("HandsRadius").Value, format); tel.UpdateObject(); Scene.AddObject(tel); ObjectsList.Items.Add(tel.ObjectName); } // if there are no objects, the user will see it. ObjectsList.SelectedIndex = -1; if (Scene.Objects.Count > 0) { ObjectsList.SelectedIndex = 0; } } catch (Exception ex) { MessageBox.Show("Не получается импортировать сцену!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void ImpBtn_Click(object sender, EventArgs e) { String FName = ""; String FValue = ""; long RecNo = 1; try { StatusLabel.Text = Localizate.getMessage(Word.PLEASE_WAIT); FileNameCombo.Enabled = false; Enabled = false; ImportDialog.InitialDirectory = RConfig.Instance.LineageDirectory; ImportDialog.FileName = selectedComboName.Substring(0, selectedComboName.LastIndexOf(".")); ImportDialog.Filter = "Tab-SeparatedValues files (*.tsv)|*.tsv"; ImportDialog.FilterIndex = 1; ImportDialog.RestoreDirectory = true; if (ImportDialog.ShowDialog() == DialogResult.OK) { DatInfo_init(); string line = ""; Encoding enc = Encoding.GetEncoding(RConfig.Instance.TextEncoding); StreamReader sr = new StreamReader(ImportDialog.FileName, enc); onStart((int)sr.BaseStream.Length); while ((line = sr.ReadLine()) != null) { if (line.StartsWith("#")) { continue; } String[] TmpStr = line.Split(new[] { '\t' }); for (int i = 0; i < TmpStr.Length; i++) { TmpStr[i] = TmpStr[i].Trim(new[] { '"' }); } Definition item = DatInfo.getDefinition(); for (int i = 0, j = 0; i < DatInfo.getFieldNames().Count; i++, j++) { FName = DatInfo.getFieldNames()[i]; FValue = TmpStr[j]; FieldInfo FType = DatInfo.getDefinition().GetType().GetField(FName); if (FType == null) { continue; } Type type = FType.FieldType; Object obj = type.InvokeMember(null, BindingFlags.CreateInstance, null, null, null); if (obj is IType) { var format = (IType)obj; format.parse(TmpStr[j], TmpStr, j, out j); FType.SetValue(item, format); } else { throw new NotImplementedException("Type " + obj.GetType().Name + " is not implement IType"); } } DatDatas.Add(item); setValue((int)sr.BaseStream.Length); RecNo++; } sr.Close(); SaveBtn2.Enabled = true; exportBtn2.Enabled = true; } else { return; } } catch (Exception ex) { _log.Info("Exception: " + ex, ex); } finally { Enabled = true; FileNameCombo.Enabled = true; onEnd(); Forms_Update(); } StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) + String.Format(Localizate.getMessage(Word.IMPORTED_DATA), DatDatas.Count); }
private void button2_Click(object sender, EventArgs e) { ImportDialog importDialog = new ImportDialog(repository); }