private void WindowPositioningEngineSnapIn_BuildingFeatureList(object sender, FeatureCollectionEventArgs e) { WindowPositioningEngineSnapIn engine = WindowPositioningEngineSnapIn.Instance; foreach (DictionaryEntry entry in engine._listeners) { WindowPositionListener wpl = (WindowPositionListener)entry.Value; IWindowPositioningEngineFeaturable featurable = wpl.Target as IWindowPositioningEngineFeaturable; if (featurable != null) { WindowPositionFeature wpf = new WindowPositionFeature(wpl.Key, "Controls the position and state of the window.", wpl.Target, FeatureActions.ResetToDefault); wpf.Tag = wpl; e.Features.Add(wpf); } } }
private void WindowPositioningEngineSnapIn_BuildingFeatureList(object sender, FeatureCollectionEventArgs e) { WindowPositioningEngineSnapIn engine = WindowPositioningEngineSnapIn.Instance; foreach(DictionaryEntry entry in engine._listeners) { WindowPositionListener wpl = (WindowPositionListener)entry.Value; IWindowPositioningEngineFeaturable featurable = wpl.Target as IWindowPositioningEngineFeaturable; if (featurable != null) { WindowPositionFeature wpf = new WindowPositionFeature(wpl.Key, "Controls the position and state of the window.", wpl.Target, FeatureActions.ResetToDefault); wpf.Tag = wpl; e.Features.Add(wpf); } } }
private void WindowPositioningEngineSnapIn_AfterActionTakenForFeature(object sender, FeatureEventArgs e) { if (e.Feature != null) { // /// is the feature a configuration? if so try and delete the file // if (e.Feature.GetType() == typeof(ConfigurationFeature)) // { // ConfigurationFeature cf = e.Feature as ConfigurationFeature; // if (cf != null) // { // switch(cf.ConfigurationName) // { // case SnapInHostingEngine.COMMON_CONFIGURATION: // if (e.Feature.Action == FeatureActions.ResetToDefault) // { // this.InstallMyCommonOptions(); // this.ReadMyCommonOptions(); // } // break; // // case SnapInHostingEngine.LOCALUSER_CONFIGURATION: // if (e.Feature.Action == FeatureActions.ResetToDefault) // { // this.InstallMyLocalUserOptions(); // this.ReadMyLocalUserOptions(); // } // break; // }; // } // } if (e.Feature.GetType() == typeof(WindowPositionFeature)) { WindowPositionFeature wpf = e.Feature as WindowPositionFeature; if (wpf != null) { WindowPositionListener wpl = wpf.Tag as WindowPositionListener; IWindowPositioningEngineFeaturable feature = wpl.Target as IWindowPositioningEngineFeaturable; wpl.Target.Size = feature.GetDefaultSize(); wpl.Target.Location = feature.GetDefaultLocation(); wpl.Target.WindowState = feature.GetDefaultWindowState(); } } } }