static void Main(string[] args) { if (args.Length >= 3) { var key = InitialKey.FromHexString(args[1]); if (key.BinaryValue == null) return; int remoteClientsCount; if (!int.TryParse(args[2], out remoteClientsCount)) return; var licenseInfo = new RubezhLicenseInfo() { RemoteClientsCount = remoteClientsCount, HasFirefighting = args.Any(x => x.Trim().ToLower() == "firefighting"), HasGuard = args.Any(x => x.Trim().ToLower() == "guard"), HasSKD = args.Any(x => x.Trim().ToLower() == "skd"), HasVideo = args.Any(x => x.Trim().ToLower() == "video"), HasOpcServer = args.Any(x => x.Trim().ToLower() == "opcserver") }; LicenseManager.TrySave(args[0], licenseInfo, key); return; } if (args.Length == 1 && args[0].ToLower().Replace("/", "-").Replace(" ", "") == "-gui") { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } }
private void buttonSave_Click(object sender, EventArgs e) { var key = InitialKey.FromHexString(textBoxKey.Text); if (key.BinaryValue == null) { MessageBox.Show("Неверный формат ключа!"); return; } if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var licenseInfo = new RubezhLicenseInfo() { RemoteClientsCount = (int)numericUpDownRemoteClientsCount.Value, HasFirefighting = checkBoxFirefighting.Checked, HasGuard = checkBoxGuard.Checked, HasSKD = checkBoxSKD.Checked, HasVideo = checkBoxVideo.Checked, HasOpcServer = checkBoxOpcServer.Checked }; if (LicenseManager.TrySave(saveFileDialog.FileName, licenseInfo, key)) MessageBox.Show("Лицензия успешно сохранена!"); else MessageBox.Show("Лицензия не сохранена!", "Ошибка сохранения", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public LicenseViewModel() { InitialKey = LicenseManager.InitialKey.ToString(); LicenseInfo = LicenseManager.CurrentLicenseInfo; LicenseManager.LicenseChanged += RubezhLicenseManager_LicenseChanged; LoadLicenseCommand = new RelayCommand(OnLoadLicenseCommand); }
public static void SetLicense(RubezhLicenseInfo licenseInfo) { if (licenseInfo == null) SetNoLicense(); else { licenseInfo.LicenseMode = LicenseMode.HasLicense; LicenseManager.CurrentLicenseInfo = licenseInfo; } }
static void RubezhLicenseManager_LicenseChanged() { LicenseInfo = LicenseManager.CurrentLicenseInfo; SetTitle(); PageController.OnPageChanged(Page.License); }
void RubezhLicenseManager_LicenseChanged() { LicenseInfo = LicenseManager.CurrentLicenseInfo; OnLicenseChanged(); }
public static bool TrySave(string path, RubezhLicenseInfo licenseInfo, InitialKey key) { return _manager.TrySave(path, licenseInfo, key); }
static void RubezhLicenseManager_LicenseChanged() { LicenseInfo = LicenseManager.CurrentLicenseInfo; SetTitle(); // TODO: Notify }