//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
namespace Revit.SDK.Samples.EventsMonitor.CS
{
///
/// The UI to allow user to choose which event they want to subscribe.
/// This class is not the main one, is just a assistant in this sample.
/// If you just want to learn how to use Revit events,
/// please pay more attention to EventManager class.
///
public partial class EventsSettingForm : System.Windows.Forms.Form
{
#region Class Member Variable
///
/// A list to storage the selection user made
///
private List m_appSelection;
#endregion
#region Class property
///
/// Property to get and set private member variables of SeletionMap
///
public List AppSelectionList
{
get
{
if (null == m_appSelection)
{
m_appSelection = new List();
}
return m_appSelection;
}
set
{
m_appSelection = value;
}
}
#endregion
#region Class Constructors
///
/// Constructor without any argument
///
public EventsSettingForm()
{
InitializeComponent();
m_appSelection = new List();
}
#endregion
#region Class Events Handler
///
/// Event handler for click OK button.
///
///
///
private void FinishToggle_Click(object sender, EventArgs e)
{
// clear lists.
m_appSelection.Clear();
foreach (object item in AppEventsCheckedList.CheckedItems)
{
m_appSelection.Add(item.ToString());
}
this.DialogResult = DialogResult.OK;
this.Hide();
}
///
/// Event handler for close windows
///
///
///
private void ToggleForm_FormClosed(object sender, FormClosedEventArgs e)
{
this.Hide();
}
///
/// Event handler for clicking check all button.
///
///
///
private void checkAllButton_Click(object sender, EventArgs e)
{
for (int i = 0; i < AppEventsCheckedList.Items.Count; i++)
{
AppEventsCheckedList.SetItemChecked(i, true);
}
}
///
/// Events handler for clicking check none button.
///
///
///
private void checkNoneButton_Click(object sender, EventArgs e)
{
for (int i = 0; i < AppEventsCheckedList.Items.Count; i++)
{
AppEventsCheckedList.SetItemChecked(i, false);
}
}
///
/// Events handler for clicking cancel button.
///
///
///
private void cancelButton_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Hide();
}
#endregion
}
}