Skip to content

Commit

Permalink
updated multilive to summarize details; updated Overlay row to add a …
Browse files Browse the repository at this point in the history
…Command; some of these updates affected "IDataManager" and "IDataManagerReadOnly"; updated tablemeta so the base entity tables discriminators don't appear in 'edit row' popup window, users don't need to specify this value; updated issue with adding a new overlay row; added multilive 'add new row' support through opening up the context menu & associated click events (just add, not edit/delete), and added 'datacollectionupdated' handler when the database table row contents are changed and refresh event bubbles up to the GUI;
  • Loading branch information
WrithemTwine committed Oct 16, 2024
1 parent 63a8359 commit 22519fb
Show file tree
Hide file tree
Showing 19 changed files with 376 additions and 326 deletions.
12 changes: 6 additions & 6 deletions BuildDatabaseMeta/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static void Main(string[] args)

foreach (PropertyInfo p in table.GetProperties())
{
if (p.Name != "Item" && ((!FileNames.Contains(p.Name) && !p.PropertyType.ToString().Contains(".Models.")) || p.Name == "UserStats"))
if (p.Name != "Item" && p.Name != "DataSource" && p.Name != "Commandtype" && ((!FileNames.Contains(p.Name) && !p.PropertyType.ToString().Contains(".Models.")) || p.Name == "UserStats"))
{
string PropName = p.PropertyType.Name.Contains("ICollection") ? $"ICollection<{p.PropertyType.GenericTypeArguments[0].FullName}>" : p.PropertyType.FullName;

Expand All @@ -73,11 +73,11 @@ static void Main(string[] args)

if (p.Name != "Duration" && p.Name != "Id" && p.Name != "Commandtype" && p.Name != "DataSource") // ignore "Duration" column as it is computed
{
copyparam.Add($" if (modelData.{p.Name} != {p.Name})\r\n" +
$" {{\r\n" +
$" modelData.{p.Name} = {p.Name};\r\n" +
$" }}\r\n");
entity.Add($" {p.Name.ToLower()[0]}{p.Name[1..]}: {newEntity}");
copyparam.Add($" if (modelData.{p.Name} != {p.Name})\r\n" +
$" {{\r\n" +
$" modelData.{p.Name} = {p.Name};\r\n" +
$" }}\r\n");
entity.Add($" {p.Name.ToLower()[0]}{p.Name[1..]}: {newEntity}");
}
param.Add($" public {PropName} {p.Name} {{ get => ({PropName})Values[\"{p.Name}\"]; set => Values[\"{p.Name}\"] = value; }}");
}
Expand Down
35 changes: 19 additions & 16 deletions StreamerBot/StreamerBot.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1498,8 +1498,7 @@ application (checked box) or your default browser (unchecked box). Then, click t
<Button x:Name="Button_DiscordWebhooks_Enabled" Width="80" Margin="10,0" Content="Enable All" Click="Button_DiscordWebhooks_Click" />
<Button x:Name="Button_DiscordWebhooks_Disabled" Width="80" Content="Disable All" Click="Button_DiscordWebhooks_Click" />
</StackPanel>
<DataGrid x:Name="DG_Webhooks" DockPanel.Dock="Top" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_Webhooks_CVS}}" CanUserDeleteRows="True" IsReadOnly="False"
ContextMenuOpening="DG_Edit_ContextMenuOpening" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_Webhooks" DockPanel.Dock="Top" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_Webhooks_CVS}}" CanUserDeleteRows="True" IsReadOnly="False" ContextMenuOpening="DG_Edit_ContextMenuOpening" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid.Columns>
<DataGridTextColumn Header="Id" Binding="{Binding Id}" IsReadOnly="True" />
<DataGridCheckBoxColumn Header="Enabled" Binding="{Binding IsEnabled}" />
Expand Down Expand Up @@ -1572,7 +1571,7 @@ application (checked box) or your default browser (unchecked box). Then, click t

<DataGrid x:Name="DG_Mod_BanRules" Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" Margin="5" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_BanRules_CVS}}" CanUserDeleteRows="True" ContextMenuOpening="DG_Edit_ContextMenuOpening" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid.Columns>
<DataGridTextColumn Header="Id}" Binding="{Binding Id}" />
<DataGridTextColumn Header="Id" Binding="{Binding Id}" />
<DataGridComboBoxColumn Header="ModAction" ItemsSource="{Binding Source={StaticResource EnumModActions}}" SelectedItemBinding="{Binding ModAction}" />
<DataGridComboBoxColumn Header="MsgType" ItemsSource="{Binding Source={StaticResource EnumMsgTypes}}" SelectedItemBinding="{Binding MsgType}" />
<DataGridTextColumn Header="Timeout Secs" Binding="{Binding TimeoutSeconds, Converter={StaticResource TimeoutSecConvert}}" />
Expand Down Expand Up @@ -1903,7 +1902,8 @@ application (checked box) or your default browser (unchecked box). Then, click t
<TabItem Header="Quotes">
<Grid>
<DockPanel Grid.Row="0" Grid.Column="0">
<Label Content="User Quotes - Use '!addquote {quote text}', '!quote'(show how many), '!quote {#}'(specific), and '!removequote {#}' to manage quotes in stream chat" DockPanel.Dock="Top" />
<TextBlock DockPanel.Dock="Top">"User Quotes - Use '!addquote {quote text}', '!quote'(show how many), '!quote {#}'(specific), and '!removequote {#}' to manage quotes in stream chat" <LineBreak />
When adding a new row, ensure "Number" doesn't duplicate in the list.</TextBlock>
<DataGrid x:Name="DG_User_Quotes" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_Quotes_CVS}}" IsReadOnly="False" CanUserDeleteRows="True"
ContextMenuOpening="DG_Edit_ContextMenuOpening"
RowEditEnding="DataGrid_RowEditEnding" >
Expand Down Expand Up @@ -2109,7 +2109,7 @@ application (checked box) or your default browser (unchecked box). Then, click t
</StackPanel>
</GroupBox>
</WrapPanel>
<DataGrid x:Name="DG_OverlayService_Actions" DockPanel.Dock="Top" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_OverlayServices_CVS}}" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_OverlayService_Actions" DockPanel.Dock="Top" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_OverlayServices_CVS}}" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" ContextMenuOpening="DG_Edit_ContextMenuOpening">
<DataGrid.Columns>
<DataGridTextColumn Header="Id" Binding="{Binding Id}" />
<DataGridTextColumn Header="Duration" Binding="{Binding Duration, Converter={StaticResource IntConverter}}" />
Expand All @@ -2128,7 +2128,8 @@ application (checked box) or your default browser (unchecked box). Then, click t
<TabItem Header="Ticker">
<DockPanel>
<TextBlock DockPanel.Dock="Top">This tab displays the data used in the 'Last User' ticker.</TextBlock>
<DataGrid x:Name="DG_OverlayService_Ticker" DockPanel.Dock="Top" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_OverlayTicker_CVS}}" CanUserDeleteRows="False" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_OverlayService_Ticker" DockPanel.Dock="Top" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_OverlayTicker_CVS}}" CanUserDeleteRows="False"
ContextMenuOpening="DG_Edit_ContextMenuOpening" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid.Columns>
<DataGridComboBoxColumn Header="Ticker Name" ItemsSource="{Binding Source={StaticResource EnumOverlayTickerItem}}" SelectedItemBinding="{Binding TickerName}" IsReadOnly="True" />
<DataGridTextColumn Header="User Name" Binding="{Binding UserName}" />
Expand All @@ -2150,7 +2151,7 @@ application (checked box) or your default browser (unchecked box). Then, click t
<Button Content="Add Random Test Stream" Height="20" Margin="10,0" ToolTip="Will activate in debug mode, won't post to social media." Click="StartDebugStream_Click"/>
<Button Content="Stop Random Test Stream" Height="20" Margin="10,0" Click="EndDebugStream_Click" />
</StackPanel>
<DataGrid x:Name="DG_StreamData_Stats" Grid.Row="1" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_StreamStats_CVS}}" RowDetailsTemplate="{StaticResource DG_RowDetailDT_StreamStats}" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_StreamData_Stats" Grid.Row="1" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_StreamStats_CVS}}" RowDetailsTemplate="{StaticResource DG_RowDetailDT_StreamStats}" RowEditEnding="DataGrid_RowEditEnding" ContextMenuOpening="DG_Edit_ContextMenuOpening">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Stream Start" CellTemplate="{StaticResource DateStreamStartTemplate}" CellEditingTemplate="{StaticResource EditStreamStartTemplate}" SortMemberPath="StreamStart" SortDirection="Descending" />
<DataGridTemplateColumn Header="Stream End" CellTemplate="{StaticResource DateStreamEndTemplate}" CellEditingTemplate="{StaticResource EditStreamEndTemplate}" SortMemberPath="StreamEnd" />
Expand Down Expand Up @@ -2204,7 +2205,7 @@ application (checked box) or your default browser (unchecked box). Then, click t

<DockPanel x:Name="DockPanel_StreamData_Raids_Incoming" Grid.Row="0" Grid.Column="0">
<TextBlock DockPanel.Dock="Top">This table saves incoming raids to your channel, so you can show them any additional appreciation after your stream. Category indicates what they were streaming.</TextBlock>
<DataGrid x:Name="DG_InRaids" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_InRaidData_CVS}}" IsReadOnly="False" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_InRaids" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_InRaidData_CVS}}" IsReadOnly="False" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" ContextMenuOpening="DG_Edit_ContextMenuOpening">
<DataGrid.Columns>
<DataGridTextColumn Header="Platform" Binding="{Binding Platform}" />
<DataGridTextColumn Header="UserId" Binding="{Binding UserId}" />
Expand All @@ -2218,7 +2219,7 @@ application (checked box) or your default browser (unchecked box). Then, click t

<DockPanel x:Name="DockPanel_StreamData_Raids_Outgoing" Grid.Row="0" Grid.Column="2">
<TextBlock DockPanel.Dock="Top">This table saves outgoing raids from your channel, so you know the channels you've raided and can spread the love.</TextBlock>
<DataGrid x:Name="DG_OutRaids" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_OutRaidData_CVS}}" CanUserDeleteRows="True" IsReadOnly="False" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_OutRaids" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_OutRaidData_CVS}}" CanUserDeleteRows="True" IsReadOnly="False" RowEditEnding="DataGrid_RowEditEnding" ContextMenuOpening="DG_Edit_ContextMenuOpening">
<DataGrid.Columns>
<DataGridTextColumn Header="Id" Binding="{Binding Id}" />
<DataGridTextColumn Header="To Channel" Binding="{Binding ChannelRaided}" />
Expand All @@ -2231,7 +2232,7 @@ application (checked box) or your default browser (unchecked box). Then, click t
<TabItem Header="Categories" x:Name="TabItem_Category">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="50" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
Expand All @@ -2241,19 +2242,21 @@ application (checked box) or your default browser (unchecked box). Then, click t
</Grid.ColumnDefinitions>

<Label Grid.Row="0" Grid.Column="0">
<TextBlock>Streaming Categories (Deleting categories may delete related data)</TextBlock>
<TextBlock>Streaming Categories (Deleting categories may delete related data)<LineBreak />
Categories with (') are adjusted for data storage and query reasons
</TextBlock>
</Label>
<DataGrid x:Name="DG_CategoryList" Grid.Row="1" Grid.Column="0" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_CategoryList_CVS}}" IsReadOnly="True" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_CategoryList" Grid.Row="1" Grid.Column="0" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_CategoryList_CVS}}" IsReadOnly="True" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" ContextMenuOpening="DG_Edit_ContextMenuOpening">
<DataGrid.Columns>
<DataGridTextColumn Header="Category Id" Binding="{Binding CategoryId}" />
<DataGridTextColumn Header="Category" Binding="{Binding Category}" />
<DataGridTextColumn Header="Category Id" Binding="{Binding CategoryId}" IsReadOnly="True" />
<DataGridTextColumn Header="Category" Binding="{Binding Category}" IsReadOnly="True" />
<DataGridTextColumn Header="Stream Count" Binding="{Binding StreamCount}" />
</DataGrid.Columns>
</DataGrid>
<Label Grid.Row="0" Grid.Column="2">
<TextBlock>Death Counter per Category</TextBlock>
</Label>
<DataGrid x:Name="DG_DeathCounter" Grid.Row="1" Grid.Column="2" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_GameDeadCounter_CVS}}" CanUserAddRows="False" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_DeathCounter" Grid.Row="1" Grid.Column="2" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_GameDeadCounter_CVS}}" CanUserAddRows="False" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" ContextMenuOpening="DG_Edit_ContextMenuOpening">
<DataGrid.Columns>
<DataGridTextColumn Header="Category" Binding="{Binding Category}" IsReadOnly="True" />
<DataGridTextColumn Header="Counter" Binding="{Binding Counter}" />
Expand All @@ -2271,7 +2274,7 @@ application (checked box) or your default browser (unchecked box). Then, click t
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Content="Clip List"/>
<DataGrid x:Name="DG_Clips" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_Clips_CVS}}" Grid.Row="1" IsReadOnly="True" CanUserAddRows="False" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" >
<DataGrid x:Name="DG_Clips" ItemsSource="{Binding Mode=OneWay, Source={StaticResource DG_Clips_CVS}}" Grid.Row="1" IsReadOnly="True" CanUserAddRows="False" CanUserDeleteRows="True" RowEditEnding="DataGrid_RowEditEnding" ContextMenuOpening="DG_Edit_ContextMenuOpening">
<DataGrid.Columns>
<DataGridTextColumn Header="ClipId" Binding="{Binding ClipId}" />
<DataGridTextColumn Header="Duration" Binding="{Binding Duration}" />
Expand Down
8 changes: 6 additions & 2 deletions StreamerBot/StreamerBotDataGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void DG_Edit_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
bool FoundAddShout = ((DataGrid)sender).Name is "DG_Users" or "DG_Followers";
bool FoundIsEnabled = ((DataGrid)sender).Columns.Select((c) => (string)c.Header == "IsEnabled").Any();
bool FoundAddItem = ((DataGrid)sender).Name is
bool FoundAddItem = ((DataGrid)sender).Name is
"DG_CurrencyType"
or "DG_CustomWelcome"
or "DG_InRaids"
Expand Down Expand Up @@ -169,10 +169,14 @@ private void DG_Edit_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
((MenuItem)M).Visibility = FoundAddItem ? Visibility.Visible : Visibility.Collapsed;
}
else if (((MenuItem)M).Name is "DataGridContextMenu_DeleteItems")
{
((MenuItem)M).Visibility = ((DataGrid)sender).CanUserDeleteRows ? Visibility.Visible : Visibility.Collapsed;
}
}
else if (M.GetType() == typeof(Separator))
{
if (((Separator)M).Name == "DataGridContextMenu_Separator")
if (((Separator)M).Name == "DataGridContextMenu_Separator1")
{
((Separator)M).Visibility = FoundAddShout ? Visibility.Visible : Visibility.Collapsed;
}
Expand Down
3 changes: 3 additions & 0 deletions StreamerBot/StreamerBotMultiLive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ private void MultiLive_Data_Loaded(object sender, RoutedEventArgs e)
{
(MultiLive_Data.Content as MultiLiveDataGrids).DataContext = Resources["DataViews"] as GUIDataManagerViews;
SetMultiLiveActive();

// attach datagrid refresh when data tables change contents (different rows do an auto refresh, row content changes do not auto refresh)
SystemsController.DataManage.OnDataCollectionUpdated += (MultiLive_Data.Content as MultiLiveDataGrids).DataManager_OnDataCollectionUpdated;
}

private const string MultiLiveName = "MultiUserLiveBot";
Expand Down
Loading

0 comments on commit 22519fb

Please sign in to comment.