private void CopyBlockToRight() { try { if ((SelectedBlock != null) && (SelectedBlock is KeyValuePair <String, Blocks>)) { KeyValuePair <String, Blocks> KVP = (KeyValuePair <String, Blocks>)SelectedBlock; if ((KVP.Value.LeftBlock.Type != PLCBlockType.SourceBlock && KVP.Value.LeftBlock.Language == PLCLanguage.SCL) || (KVP.Value.RightBlock.Type != PLCBlockType.SourceBlock && KVP.Value.RightBlock.Language == PLCLanguage.SCL)) { MessageBox.Show("You are trying to copy block compiled from the SCL source. You have to copy SCL source block manually.", "Warning!", MessageBoxButton.OK); } if (MessageBox.Show("Are you sure you want to copy block <" + KVP.Key + "> to the right project?", "Warning. Overwriting block.", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { S7Model.CurrentBlock = KVP; S7Model.CopyBlockToRight(); } } } catch (Exception err) { EventFire.Error(err.ToString()); } }
private void ExportAlarmWorxPortal() { VistaSaveFileDialog selectFileDialog = new VistaSaveFileDialog(); VistaOpenFileDialog openFileDialog = new VistaOpenFileDialog(); openFileDialog.Title = "Select DB Text File Location"; openFileDialog.AddExtension = true; openFileDialog.DefaultExt = ".db"; openFileDialog.Filter = "DB File|*.db"; if (Directory.Exists(S7Model.WinCCPortalDigitalAlarmsImportFilePath)) { openFileDialog.InitialDirectory = Properties.Settings.Default.WinCCPortalDigitalAlarmsImportFilePath; } if ((bool)openFileDialog.ShowDialog()) { selectFileDialog.Title = "Select Export Location"; selectFileDialog.AddExtension = true; selectFileDialog.DefaultExt = ".csv"; selectFileDialog.Filter = "CSV File|*.csv"; if (Directory.Exists(S7Model.WinCCPortalDigitalAlarmsExportFilePath)) { selectFileDialog.InitialDirectory = Properties.Settings.Default.WinCCPortalDigitalAlarmsExportFilePath; } if ((bool)selectFileDialog.ShowDialog()) { S7Model.ExportAlarmWorxPortal(openFileDialog.FileName, selectFileDialog.FileName); } } }
public void OnClosing(object sender, CancelEventArgs e) { try { S7Model.ClearTempDirectories(); } catch (Exception err) { EventFire.Error(err.ToString()); } }
private void StartDiffProcess() { try { if ((SelectedBlock != null) && (SelectedBlock is KeyValuePair <String, Blocks>)) { KeyValuePair <String, Blocks> KVP = (KeyValuePair <String, Blocks>)SelectedBlock; S7Model.CurrentBlock = KVP; S7Model.StartDiffProcess(); } } catch (Exception err) { EventFire.Error(err.ToString()); } }
private void Save() { try { if (S7Model.RightProjectPath.ToLower().EndsWith(".zip")) { if (MessageBox.Show("Are you sure you want to save right project?", "Warning. Overwriting archive.", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { S7Model.Save(); } } } catch (Exception err) { EventFire.Error(err.ToString()); } }
private void ExportAllBlocks() { VistaSaveFileDialog selectFileDialog = new VistaSaveFileDialog(); selectFileDialog.AddExtension = true; selectFileDialog.DefaultExt = ".csv"; selectFileDialog.Title = "Select Export Location"; selectFileDialog.Filter = "CSV File|*.csv"; if (Directory.Exists(S7Model.AllBlocksExportFilePath)) { selectFileDialog.InitialDirectory = Properties.Settings.Default.AllBlocksExportFilePath; } if ((bool)selectFileDialog.ShowDialog())// == DialogResult.OK) { S7Model.AllBlocksExportFilePath = selectFileDialog.FileName; Properties.Settings.Default.AllBlocksExportFilePath = selectFileDialog.FileName; Properties.Settings.Default.Save(); S7Model.ExportAllBlocks(); } }
private void ExportKepwareAllBlocks() { VistaSaveFileDialog selectFileDialog = new VistaSaveFileDialog(); selectFileDialog.Title = "Select Export Location"; selectFileDialog.AddExtension = true; selectFileDialog.DefaultExt = ".csv"; selectFileDialog.Filter = "CSV File|*.csv"; if (Directory.Exists(S7Model.KepwareExportFilePath)) { selectFileDialog.InitialDirectory = Properties.Settings.Default.KepwareExportFilePath; } if ((bool)selectFileDialog.ShowDialog())// == DialogResult.OK) { S7Model.KepwareExportFilePath = selectFileDialog.FileName; Properties.Settings.Default.KepwareExportFilePath = selectFileDialog.FileName; Properties.Settings.Default.Save(); //S7Model.ExportKepware(); //place code here for exporting all blocks instead of selected block. S7Model.ExportKepwareAllBlocks(); } }
private void ExportWinCCPortalDigitalAlarms(bool comfortSelected) { VistaSaveFileDialog selectFileDialog = new VistaSaveFileDialog(); VistaOpenFileDialog openFileDialog = new VistaOpenFileDialog(); openFileDialog.Title = "Select DB Text File Location"; openFileDialog.AddExtension = true; openFileDialog.DefaultExt = ".db"; openFileDialog.Filter = "DB File|*.db"; if (Directory.Exists(S7Model.WinCCPortalDigitalAlarmsImportFilePath)) { openFileDialog.InitialDirectory = Properties.Settings.Default.WinCCPortalDigitalAlarmsImportFilePath; } if ((bool)openFileDialog.ShowDialog()) { S7Model.WinCCPortalDigitalAlarmsImportFilePath = openFileDialog.FileName; Properties.Settings.Default.WinCCPortalDigitalAlarmsImportFilePath = openFileDialog.FileName; Properties.Settings.Default.Save(); } selectFileDialog.Title = "Select Export Location"; selectFileDialog.AddExtension = true; selectFileDialog.DefaultExt = ".xlsx"; selectFileDialog.Filter = "Excel 2007 File|*.xlsx"; if (Directory.Exists(S7Model.WinCCPortalDigitalAlarmsExportFilePath)) { selectFileDialog.InitialDirectory = Properties.Settings.Default.WinCCPortalDigitalAlarmsExportFilePath; } if ((bool)selectFileDialog.ShowDialog()) { S7Model.WinCCPortalDigitalAlarmsExportFilePath = selectFileDialog.FileName; Properties.Settings.Default.WinCCPortalDigitalAlarmsExportFilePath = selectFileDialog.FileName; Properties.Settings.Default.Save(); S7Model.ExportWinCCPortalDigitalAlarms(comfortSelected); } }
private void GetBlocks() { try { if (ExtractLeftProjectPath != "" || ExtractRightProjectPath != "") { if (MessageBox.Show("Are you sure you want to reload projects?", "Warning. Unsave changes.", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { // Reload both projects S7Model.GetBlocks(); } } else { // We don't have unpacked projects - just reload S7Model.GetBlocks(); } } catch (Exception err) { EventFire.Error(err.ToString()); } }
public void OnClosing(object sender, CancelEventArgs e) { S7Model.ClearTempDirectories(); }
private void GetBlocks() { S7Model.GetBlocks(); }
private void GetBlockTags() { S7Model.GetAllTags(); }
private void AddTrendTag() { S7Model.AddTrendTag(); }