示例#1
0
		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());
			}
		}
示例#2
0
		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);
			}
		}
示例#3
0
		public LicenseViewModel()
		{
			InitialKey = LicenseManager.InitialKey.ToString();
			LicenseInfo = LicenseManager.CurrentLicenseInfo;
			LicenseManager.LicenseChanged += RubezhLicenseManager_LicenseChanged;
			LoadLicenseCommand = new RelayCommand(OnLoadLicenseCommand);
		}
示例#4
0
		public static void SetLicense(RubezhLicenseInfo licenseInfo)
		{
			if (licenseInfo == null)
				SetNoLicense();
			else
			{
				licenseInfo.LicenseMode = LicenseMode.HasLicense;
				LicenseManager.CurrentLicenseInfo = licenseInfo;
			}
		}
示例#5
0
		static void RubezhLicenseManager_LicenseChanged()
		{
			LicenseInfo = LicenseManager.CurrentLicenseInfo;
			SetTitle();
			PageController.OnPageChanged(Page.License);
		}
示例#6
0
		void RubezhLicenseManager_LicenseChanged()
		{
			LicenseInfo = LicenseManager.CurrentLicenseInfo;
			OnLicenseChanged();
		}
示例#7
0
		public static bool TrySave(string path, RubezhLicenseInfo licenseInfo, InitialKey key)
		{
			return _manager.TrySave(path, licenseInfo, key);
		}
示例#8
0
		static void RubezhLicenseManager_LicenseChanged()
		{
			LicenseInfo = LicenseManager.CurrentLicenseInfo;
			SetTitle();
            // TODO: Notify
        }