Example #1
0
 protected bool PromptToModifyRecipientScope(IUIService uiService, ExchangePropertyPageControl scopeControl)
 {
     if (scopeControl == null)
     {
         throw new ArgumentNullException("scopeControl");
     }
     using (PropertyPageDialog propertyPageDialog = new PropertyPageDialog(scopeControl))
     {
         ScopeSettings scopeSettings = new ScopeSettings();
         scopeSettings.CopyFrom(this.ScopeSettings);
         scopeControl.Context = new DataContext(new ExchangeDataHandler());
         scopeControl.Context.DataHandler.DataSource = scopeSettings;
         if (uiService.ShowDialog(propertyPageDialog) == DialogResult.OK && scopeSettings.ObjectState == ObjectState.Changed)
         {
             this.ScopeSettings.CopyChangesFrom(scopeSettings);
             this.UpdateText();
             return(true);
         }
     }
     return(false);
 }
		public PropertySheetDialog()
		{
			this.InitializeComponent();
			base.Size = new Size(443, 507);
			this.cancelButton.Text = Strings.Cancel;
			this.okButton.Text = Strings.Ok;
			this.applyButton.Text = Strings.PropertySheetDialogApply;
			this.helpButton.Text = Strings.PropertySheetDialogHelp;
			if (PropertySheetDialog.lockImage == null)
			{
				Size empty = Size.Empty;
				empty.Width = Math.Min(this.lockButton.Width, this.lockButton.Height);
				empty.Height = empty.Width;
				PropertySheetDialog.lockImage = IconLibrary.ToBitmap(Icons.LockIcon, empty);
				PropertySheetDialog.commandLogPropertyExposureEnabledImage = IconLibrary.ToBitmap(Icons.CommandLogPropertyExposureEnabled, empty);
				PropertySheetDialog.commandLogPropertyExposureDisabledImage = IconLibrary.ToBitmap(Icons.CommandLogPropertyExposureDisabled, empty);
			}
			this.commandExposureButton.Image = PropertySheetDialog.commandLogPropertyExposureDisabledImage;
			this.lockButton.Image = PropertySheetDialog.lockImage;
			ToolTip toolTip = new ToolTip();
			toolTip.SetToolTip(this.lockButton, Strings.ShowLockButtonToolTipText);
			toolTip.SetToolTip(this.commandExposureButton, Strings.ShowEMSCommand);
			this.applyButton.Enabled = false;
			this.lockButton.Visible = false;
			this.lockButton.FlatStyle = FlatStyle.Flat;
			this.lockButton.FlatAppearance.BorderSize = 0;
			this.lockButton.FlatAppearance.BorderColor = this.lockButton.BackColor;
			this.lockButton.FlatAppearance.MouseOverBackColor = this.lockButton.BackColor;
			this.lockButton.FlatAppearance.MouseDownBackColor = this.lockButton.BackColor;
			this.commandExposureButton.Enabled = false;
			this.commandExposureButton.FlatStyle = FlatStyle.Flat;
			this.commandExposureButton.FlatAppearance.BorderSize = 0;
			this.commandExposureButton.FlatAppearance.BorderColor = this.commandExposureButton.BackColor;
			this.applyButton.Click += delegate(object param0, EventArgs param1)
			{
				this.PerformApply();
				this.SetActivePage((ExchangePropertyPageControl)this.tabControl.SelectedTab.Tag);
			};
			this.commandExposureButton.MouseEnter += delegate(object param0, EventArgs param1)
			{
				if (this.commandExposureButton.Enabled)
				{
					this.commandExposureButton.FlatStyle = FlatStyle.Standard;
				}
			};
			this.commandExposureButton.MouseLeave += delegate(object param0, EventArgs param1)
			{
				this.commandExposureButton.FlatStyle = FlatStyle.Flat;
			};
			this.commandExposureButton.Click += delegate(object param0, EventArgs param1)
			{
				if (this.isValid && this.isDirty && ((ExchangePropertyPageControl)this.tabControl.SelectedTab.Tag).OnKillActive())
				{
					List<DataHandler> list = new List<DataHandler>();
					ExchangePropertyPageControl[] array = (ExchangePropertyPageControl[])this.tabControl.Tag;
					foreach (ExchangePropertyPageControl exchangePropertyPageControl in array)
					{
						if (exchangePropertyPageControl.IsHandleCreated && exchangePropertyPageControl.Context != null && exchangePropertyPageControl.Context.IsDirty)
						{
							if (!exchangePropertyPageControl.TryApply())
							{
								return;
							}
							if (!list.Contains(exchangePropertyPageControl.DataHandler))
							{
								list.Add(exchangePropertyPageControl.DataHandler);
							}
						}
					}
					StringBuilder stringBuilder = new StringBuilder();
					foreach (DataHandler dataHandler in list)
					{
						stringBuilder.Append(dataHandler.CommandToRun);
					}
					using (PropertyPageDialog propertyPageDialog = new PropertyPageDialog(new PropertyPageCommandExposureControl
					{
						CommandToShow = stringBuilder.ToString()
					}))
					{
						propertyPageDialog.CancelVisible = false;
						((ExchangePage)this.tabControl.SelectedTab.Tag).ShowDialog(propertyPageDialog);
					}
				}
			};
			this.helpButton.Click += delegate(object param0, EventArgs param1)
			{
				this.OnHelpRequested(new HelpEventArgs(Point.Empty));
			};
		}