Skip to content

Commit

Permalink
removed some colors that weren't working and added double click suppo…
Browse files Browse the repository at this point in the history
…rt to the search results list
  • Loading branch information
MikePohatu committed Jul 21, 2017
1 parent c720251 commit 33a3e8d
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Visualizer/CollectionNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void OnCollectionPropertyChanged(object sender, PropertyChangedEventArgs
}
else
{
this.Attr.LineWidth = 1;
this.Attr.LineWidth = _normallinewidth;
this.Attr.Color = Color.Black;
}
}
Expand Down
1 change: 1 addition & 0 deletions Visualizer/Panes/ApplicationPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public ApplicationPane(SccmConnector connector): base(connector)
this._pane.DataContext = this;
this._pane.searchbtn.KeyUp += this.OnBuildKeyUp;
this._pane.buildbtn.Click += this.OnBuildButtonPressed;
this._pane.searchresultslb.MouseDoubleClick += this.OnSearchResultsListDoubleClick;
this._pane.searchbtn.Click += this.OnSearchButtonPressed;
this._pane.searchtb.KeyUp += this.OnSearchKeyUp;
//this._pane.gviewer.AsyncLayoutProgress += this.OnProgressUpdate;
Expand Down
2 changes: 1 addition & 1 deletion Visualizer/Panes/ApplicationTabControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</Grid>

<ListBox x:Name="searchresultslb" Grid.Row="1" MinHeight="130"
ItemsSource="{Binding SearchResults}" SelectedItem="{Binding SelectedResult, Mode=TwoWay}"
ItemsSource="{Binding SearchResults}" SelectedItem="{Binding SelectedResult, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="ID" Style="{DynamicResource ListBoxStyle}">
<ListBox.ItemTemplate>
<DataTemplate>
Expand Down
1 change: 1 addition & 0 deletions Visualizer/Panes/BaseCollectionPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public BaseCollectionPane(SccmConnector connector):base(connector)
MsaglHelpers.ConfigureCollectionsGViewer(this._pane.gviewer);
this._pane.DataContext = this;
this._pane.buildbtn.Click += this.OnBuildButtonPressed;
this._pane.searchresultslb.MouseDoubleClick += this.OnSearchResultsListDoubleClick;
this._pane.gviewer.AsyncLayoutProgress += this.OnProgressUpdate;
this._pane.gviewer.MouseDoubleClick += this.OnGViewerMouseDoubleClick;
//this._pane.abortbtn.Click += OnAbortButtonClick;
Expand Down
8 changes: 8 additions & 0 deletions Visualizer/Panes/BasePane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ protected void OnBuildKeyUp(object sender, KeyEventArgs e)
this.BuildGraph();
}
}
protected void OnSearchResultsListDoubleClick(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
//if (this._selectedresult != null) { this.BuildGraph(); }
this.BuildGraph();
}
}

protected void OnBuildButtonPressed(object sender, RoutedEventArgs e)
{
Expand Down
5 changes: 5 additions & 0 deletions Visualizer/Panes/DeploymentsPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public DeploymentsPane(SccmConnector connector):base(connector)
MsaglHelpers.ConfigureCollectionsGViewer(this._pane.gviewer);
this._pane.DataContext = this;
this._pane.buildbtn.Click += this.OnBuildButtonPressed;
this._pane.searchresultslb.MouseDoubleClick += this.OnSearchResultsListDoubleClick;
this._pane.gviewer.MouseClick += this.OnGViewerMouseClicked;
this._pane.gviewer.MouseDoubleClick += this.OnGViewerMouseDoubleClick;
this._pane.searchbtn.Click += this.OnSearchButtonPressed;
Expand Down Expand Up @@ -68,6 +69,7 @@ protected virtual void OnGViewerMouseDoubleClick(object sender, System.Windows.F
else if (this.SelectedNode.SccmObject is SccmSoftwareUpdateGroup) { this._pane.modecombo.Text = "Update Group"; }
else if (this.SelectedNode.SccmObject is SMS_DeploymentSummary) { this._pane.modecombo.Text = "Deployment"; }
else if (this.SelectedNode.SccmObject is SccmSoftwareUpdate) { this._pane.modecombo.Text = "Update"; }
else if (this.SelectedNode.SccmObject is SccmTaskSequence) { this._pane.modecombo.Text = "Task Sequence"; }
}
}
}
Expand Down Expand Up @@ -105,6 +107,9 @@ protected async void UpdateSearchResults()
else if (this._pane.modecombo.Text == "Update")
{ await Task.Run(() => this.SearchResults = this._connector.GetSoftwareUpdateSccmObjectsFromSearch(this._searchtext)); }

else if (this._pane.modecombo.Text == "Task Sequence")
{ await Task.Run(() => this.SearchResults = this._connector.GetTaskSequenceSccmObjectsFromSearch(this._searchtext)); }

this._processing = false;
this.ControlsEnabled = true;
}
Expand Down
3 changes: 2 additions & 1 deletion Visualizer/Panes/DeploymentsTabControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<ComboBoxItem>Application</ComboBoxItem>
<ComboBoxItem IsSelected="True">Collection</ComboBoxItem>
<!--<ComboBoxItem>Deployment</ComboBoxItem>-->
<ComboBoxItem>Task Sequence</ComboBoxItem>
<ComboBoxItem>Update</ComboBoxItem>
<ComboBoxItem>Update Group</ComboBoxItem>
</ComboBox>
Expand All @@ -62,7 +63,7 @@
</Grid>

<ListBox Grid.Row="2" x:Name="searchresultslb" MinHeight="130"
ItemsSource="{Binding SearchResults}" SelectedItem="{Binding SelectedResult, Mode=TwoWay}"
ItemsSource="{Binding SearchResults}" SelectedItem="{Binding SelectedResult, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="ID" Style="{DynamicResource ListBoxStyle}">
<ListBox.ItemTemplate>
<DataTemplate>
Expand Down
2 changes: 1 addition & 1 deletion Visualizer/Panes/ResourceTabControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</StackPanel>

<ListBox Grid.Row="1" x:Name="searchresultslb" MinHeight="130"
ItemsSource="{Binding SearchResults}" SelectedItem="{Binding SelectedResult, Mode=TwoWay}"
ItemsSource="{Binding SearchResults}" SelectedItem="{Binding SelectedResult, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="CIID"
Style="{DynamicResource ListBoxStyle}">
<ListBox.ItemTemplate>
Expand Down
52 changes: 43 additions & 9 deletions Visualizer/SccmNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Visualizer
{
public class SccmNode : Node
{
protected int _highlightedlinewidth = 5;
protected int _highlightedlinewidth = 4;
protected int _normallinewidth = 3;

protected ISccmObject _sccmobject;
Expand All @@ -26,7 +26,8 @@ public SccmNode(string id, ISccmObject sccmobject) :base(id)
this.Attr.YRadius = 3;
this.Attr.Padding = 3;
this.Attr.LabelMargin = 5;

this.Attr.LineWidth = this._normallinewidth;

this.SetLayout();
}

Expand All @@ -39,25 +40,58 @@ public virtual void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
this.Attr.LineWidth = this._highlightedlinewidth;
this.Attr.Color = Color.Green;
//this.Attr.FillColor = Color.LightGreen;
}
else
{
this.Attr.LineWidth = this._normallinewidth;
this.Attr.Color = Color.Black;
//this.Attr.Color = Color.White;
}
}
}

protected void SetLayout()
{
string prefix = string.Empty;
if (this._sccmobject is SccmApplication) { this.Attr.Color = Color.SandyBrown; prefix = "Application: "; }
else if (this._sccmobject is SMS_DeploymentSummary) { this.Attr.Color = Color.LightBlue; prefix = "Deployment: "; }
else if (this._sccmobject is SccmCollection) { this.Attr.Color = Color.RoyalBlue; prefix = "Collection: "; }
else if (this._sccmobject is SccmSoftwareUpdateGroup) { this.Attr.Color = Color.Gold; prefix = "SUG: "; }
else if (this._sccmobject is SccmTaskSequence) { this.Attr.Color = Color.Thistle; prefix = "Task Sequence: "; }
else if (this._sccmobject is SccmPackage) { this.Attr.Color = Color.Chocolate; prefix = "Package: "; }
else if (this._sccmobject is SccmConfigurationBaseline) { this.Attr.Color = Color.CornflowerBlue; prefix = "Baseline: "; }
//if (this._sccmobject is SccmApplication) { this.Attr.Color = Color.SandyBrown; prefix = "Application: "; }
////else if (this._sccmobject is SMS_DeploymentSummary) { this.Attr.Color = Color.LightBlue; prefix = "Deployment: "; }
//else if (this._sccmobject is SccmCollection) { this.Attr.Color = Color.RoyalBlue; prefix = "Collection: "; }
//else if (this._sccmobject is SccmSoftwareUpdateGroup) { this.Attr.Color = Color.Gold; prefix = "SUG: "; }
//else if (this._sccmobject is SccmTaskSequence) { this.Attr.Color = Color.Thistle; prefix = "Task Sequence: "; }
//else if (this._sccmobject is SccmPackage) { this.Attr.Color = Color.Chocolate; prefix = "Package: "; }
//else if (this._sccmobject is SccmConfigurationBaseline) { this.Attr.Color = Color.CornflowerBlue; prefix = "Baseline: "; }

switch (this._sccmobject.Type)
{
case SccmItemType.Application:
//this.Attr.Color = Color.SandyBrown;
prefix = "Application: ";
break;
case SccmItemType.Collection:
//this.Attr.Color = Color.RoyalBlue;
prefix = "Collection: ";
break;
case SccmItemType.SoftwareUpdateGroup:
//this.Attr.Color = Color.Gold;
prefix = "SUG: ";
break;
case SccmItemType.TaskSequence:
//this.Attr.Color = Color.Thistle;
prefix = "Task Sequence: ";
break;
case SccmItemType.Package:
//this.Attr.Color = Color.Chocolate;
prefix = "Package: ";
break;
case SccmItemType.ConfigurationBaseline:
//this.Attr.Color = Color.CornflowerBlue;
prefix = "Baseline: ";
break;
default:
break;

}

this.LabelText = this._sccmobject.Name + Environment.NewLine + prefix + this._sccmobject.ID;
}
Expand Down
13 changes: 12 additions & 1 deletion viewmodel/Factory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static SccmCollection GetCollectionFromSMS_CollectionResults(IResultObjec
item.Comment = ResultObjectHandler.GetString(resource, "Comment");
item.IncludeExcludeCollectionCount = ResultObjectHandler.GetInt(resource, "IncludeExcludeCollectionsCount");
int typeint = ResultObjectHandler.GetInt(resource, "CollectionType");
item.Type = (CollectionType)typeint;
item.CollectionType = (CollectionType)typeint;

return item;
}
Expand Down Expand Up @@ -186,5 +186,16 @@ public static SMS_DeploymentInfo GetDeploymentInfoFromSMS_DeploymentInfoResults(

return item;
}

public static SccmTaskSequence GetTaskSequenceFromSMS_TaskSequenceResults(IResultObject resource)
{
SccmTaskSequence item = new SccmTaskSequence();

item.ID = ResultObjectHandler.GetString(resource, "PackageID");
item.Name = ResultObjectHandler.GetString(resource, "Name");
int tstype = ResultObjectHandler.GetInt(resource, "Type");
item.TaskSequenceType = (TaskSequenceType)tstype;
return item;
}
}
}
1 change: 1 addition & 0 deletions viewmodel/ISccmObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace viewmodel
{
public interface ISccmObject
{
SccmItemType Type { get; }
event PropertyChangedEventHandler PropertyChanged;
string ID { get; }
string Name { get; }
Expand Down
1 change: 1 addition & 0 deletions viewmodel/SMS_DeploymentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/// </summary>
public class SMS_DeploymentInfo: ViewModelBase, IDeployment
{
public SccmItemType Type { get { return SccmItemType.SMS_DeploymentInfo; } }
protected string _collectionid;
public string CollectionID
{
Expand Down
1 change: 1 addition & 0 deletions viewmodel/SMS_DeploymentSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/// </summary>
public class SMS_DeploymentSummary: ViewModelBase, IDeployment
{
public SccmItemType Type { get { return SccmItemType.SMS_DeploymentSummary; } }
protected string _collectionid;
public string CollectionID
{
Expand Down
3 changes: 2 additions & 1 deletion viewmodel/SccmCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ namespace viewmodel
{
public class SccmCollection: ViewModelBase, ISccmObject
{
public SccmItemType Type { get { return SccmItemType.Collection; } }
public string LimitingCollectionID { get; set; }
public SccmCollection LimitingCollection { get; set; }
public CollectionType Type { get; set; }
public CollectionType CollectionType { get; set; }

private string _comment;
public string Comment
Expand Down
52 changes: 23 additions & 29 deletions viewmodel/SccmConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,35 +518,29 @@ public List<ISccmObject> GetSoftwareUpdateGroupSccmObjectsFromSearch(string cina
return CIs;
}

//public SccmApplication GetApplication(string ciid)
//{
// try
// {
// // This query selects all collections
// string query = "select * from SMS_Application WHERE IsLatest='TRUE' AND CI_ID='" + ciid + "'";

// // Run query
// using (IResultObject results = this._connection.QueryProcessor.ExecuteQuery(query))
// {
// // Enumerate through the collection of objects returned by the query.
// foreach (IResultObject resource in results)
// {
// SccmApplication app = new SccmApplication();
// app.CIID = resource["CI_ID"].IntegerValue.ToString();
// app.Name = resource["LocalizedDisplayName"].StringValue;
// app.IsDeployed = resource["IsDeployed"].BooleanValue;
// app.IsEnabled = resource["IsEnabled"].BooleanValue;
// app.IsSuperseded = resource["IsSuperseded"].BooleanValue;
// app.IsSuperseding = resource["IsSuperseding"].BooleanValue;
// app.IsLatest = resource["IsLatest"].BooleanValue;
// return app;
// }
// }

// }
// catch { }
// return null;
//}
public List<ISccmObject> GetTaskSequenceSccmObjectsFromSearch(string search)
{
List<ISccmObject> items = new List<ISccmObject>();
try
{
string query;
if (string.IsNullOrWhiteSpace(search)) { query = "select * from SMS_TaskSequencePackage ORDER BY Name"; }
else { query = "select * from SMS_TaskSequencePackage WHERE Name LIKE '%" + search + "%' ORDER BY Name"; }

// Run query
using (IResultObject results = this._connection.QueryProcessor.ExecuteQuery(query))
{
// Enumerate through the collection of objects returned by the query.
foreach (IResultObject resource in results)
{
SccmTaskSequence app = Factory.GetTaskSequenceFromSMS_TaskSequenceResults(resource);
items.Add(app);
}
}
}
catch { }
return items;
}

public SccmDevice GetDevice(string name)
{
Expand Down
6 changes: 5 additions & 1 deletion viewmodel/SccmEnums.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace viewmodel
{
public enum TaskSequenceType { Generic = 1, OSD = 2 }
public enum SccmItemType {
Application = 1,
Package = 2,
Expand All @@ -14,6 +15,9 @@ public enum SccmItemType {
ConfigurationPolicy=11,
SoftwareUpdate = 37,
Device,
User
User,
Collection,
SMS_DeploymentInfo,
SMS_DeploymentSummary
}
}
1 change: 1 addition & 0 deletions viewmodel/SccmTaskSequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public class SccmTaskSequence : SccmDeployableItem
{
public override SccmItemType Type { get { return SccmItemType.TaskSequence; } }
public TaskSequenceType TaskSequenceType { get; set; }

public new string ToString()
{
Expand Down

0 comments on commit 33a3e8d

Please sign in to comment.