Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public static FormSettings Create(Form frm)
        {
            var formSettings = new FormSettings();

            formSettings.InitializeForm(frm);
            return(formSettings);
        }
		/// <summary />
		public IMDIArchivingDlg(ArchivingDlgViewModel model, string localizationManagerId, Font programDialogFont, FormSettings settings) 
			: base(model, localizationManagerId, programDialogFont, settings)
		{
			// DO NOT SHOW THE LAUNCH OPTION AT THIS TIME
			model.PathToProgramToLaunch = null;

			InitializeNewControls();

			// get the saved IMDI program value
			GetSavedValues();

			// set control properties
			SetControlProperties();
		}
Example #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public static FormSettings Create(Form frm)
		{
			var formSettings = new FormSettings();
			formSettings.InitializeForm(frm);
			return formSettings;
		}
Example #4
0
		/// ------------------------------------------------------------------------------------
		/// <param name="model">View model</param>
		/// <param name="localizationManagerId">The ID of the localization manager for the
		/// calling application.</param>
		/// <param name="programDialogFont">Application can set this to ensure a consistent look
		/// in the UI (especially useful for when a localization requires a particular font).</param>
		/// <param name="settings">Location, size, and state where the client would like the
		/// dialog box to appear (can be null)</param>
		/// ------------------------------------------------------------------------------------
		public ArchivingDlg(ArchivingDlgViewModel model, string localizationManagerId,
			Font programDialogFont, FormSettings settings)
		{
			_settings = settings ?? FormSettings.Create(this);

			_viewModel = model;

			InitializeComponent();

			if (!string.IsNullOrEmpty(localizationManagerId))
				locExtender.LocalizationManagerId = localizationManagerId;

			Text = string.Format(Text, model.AppName, model.ArchiveType);
			_progressBar.Visible = false;

			// remember this because we will need it later in a derived class
			_launchButtonTextFormat = _buttonLaunchRamp.Text;

			UpdateLaunchButtonText();
			_buttonLaunchRamp.Enabled = false; //!string.IsNullOrEmpty(model.PathToProgramToLaunch);

			_linkOverview.Text = model.InformativeText;
			_linkOverview.Links.Clear();

			if (!string.IsNullOrEmpty(model.ArchiveInfoUrl) && !string.IsNullOrEmpty(model.ArchiveInfoHyperlinkText))
			{
				int i = _linkOverview.Text.IndexOf(model.ArchiveInfoHyperlinkText, StringComparison.InvariantCulture);
				if (i >= 0)
					_linkOverview.Links.Add(i, model.ArchiveInfoHyperlinkText.Length, model.ArchiveInfoUrl);
			}

			// this is for a display problem in mono
			_linkOverview.SizeToContents();
			_logBox.Tag = false;

			model.OnDisplayMessage += DisplayMessage;
			model.OnDisplayError += new ArchivingDlgViewModel.DisplayErrorEventHandler(model_DisplayError);

			if (programDialogFont != null)
			{
				_linkOverview.Font = programDialogFont;
				_logBox.Font = FontHelper.MakeFont(programDialogFont, FontStyle.Bold);
				_buttonCancel.Font = programDialogFont;
				_buttonCreatePackage.Font = programDialogFont;
				_buttonLaunchRamp.Font = programDialogFont;
				Font = programDialogFont;
			}

			_buttonLaunchRamp.Click += (s, e) => model.LaunchArchivingProgram();

			_buttonCancel.MouseLeave += delegate
			{
				if (model.IsBusy)
					WaitCursor.Show();
			};

			_buttonCancel.MouseEnter += delegate
			{
				if (model.IsBusy)
					WaitCursor.Hide();
			};

			_buttonCancel.Click += delegate
			{
				model.Cancel();
				WaitCursor.Hide();
			};

			_buttonCreatePackage.Click += delegate
			{
				Focus();
				_buttonCreatePackage.Enabled = false;
				_progressBar.Visible = true;
				WaitCursor.Show();
				_logBox.Clear();
				_buttonLaunchRamp.Enabled = model.CreatePackage();
				_buttonCreatePackage.Enabled = false;
				_progressBar.Visible = false;
				WaitCursor.Hide();
			};
		}