Skip to content

Commit

Permalink
Modernize & Optimize UI (#233)
Browse files Browse the repository at this point in the history
* Modernize & Optimize UI (Part 1)

WARNING
- Redundancies in Symbol Declarations
  * Redundant class or interface specification in base types list
      Base type is already specified in other parts (20)
  * Redundant member initializer
      Initializing field/property by default value is redundant (18)
- Constraints Violations
  * Possible 'null' assignment to non-nullable entity
      Possible 'null' assignment to non-nullable entity (2)
- Potential Code Quality Issues
  * Missin grid column/row setter for non-first child
      Missing Grid.Column/Row setter for non-first-child (10)
  * Grid element column/row index is out of grid definition range
      Column index 3 is out of grid column definition range (0-2) (1)
	  Column index 1 with span 6 is out of grid column definitions range (0-3) (2)
- Redundancies in code
  * Redundant using directive
      Using directive is not required by the code and can be safely removed (9)
  * Redundant name qualifier
      Quaelifier is redundant (9)
  * Redundant cast
      Type cast is redundant (6)
  * Redundant control flow jump statement
      Redundant control flow jump statement (5)
  * Redundant argument with default value
      The parameter 'playing' has the same default value (4)
  * Redundant empty switch section
      Redundant empty switch section (3)
  * Redundant namespace alias
      Namespace alias 'd' is not required by code and can be safely removed
	  Namespace alias 'mc' is not required by code and can be safely removed
  * Redundant explicit type in  array creation
      Redundant explicit array type specification (2)
  * Remove redundant attached property setter
      Attached property setter has no effect in the current context and can be removed (6)
- Redundancies in Symbol Declarations
  * Redundant member initializer
      Initializing property by default value is redundant (1)
- Formatting
  * Incorrect indent
      Line is not indented relative to the previous line around child statement, expected indent 4 spaces (1)
- Common Practices and Code Improvements
  * Empty statement is redundant
      Empty statement is redundant (3)
- Potential Code Quality Issues
  * Invalid XML documentation comment
      Parameter 'activeVoices' has no matching param tag (1)
	  Cannot resolve parameter 'playlistname'
  * Empty general catch clause
      Empty general catch clause suppresses any errors (1)
  * Element is localizable
      Localizable string (4)
  * Possible multiple enumeration
      Possible multiple enumeration (3)
  * Possible 'System.InvalidOperationException'
      Possible 'System.InvalidOperationException' (2)
  * Possible 'SystemNullReferenceException'
      Possible 'SystemNullReferenceException' (13)
- Redundancies in Code
  * Assignment is not used
      Value assigned is not used in any execution path (6)

SUGGESTION
- Spelling Issues
  * Typo in comment
      Various (?)
  * Typo in markup attribute value
      Various (?)
  * Typo in identifier
      Various (?)
  * Typo in string literal
      Various (?)
- Common Practices and Code Improvements
  * Local variable has too wide declaration scope
      Local variable 'myStream' can be declared in inner scope
	  Local variable 'noteCountDict' can be declared in inner scope
  * Replace with single call to First(..)
      Replace with single call to First(..) (1)
  * Join local variable declaration and assignment
      Join declaration and assignment (3)
- Language Usage Opportunities
  * Use object or collection initializer when possible
      Use object initializer (8)
  * Use string interpolation expression
      Use string interpolation expression (2)
  * Convert 'as' expression type check and the following null check into pattern matching
      Use pattern matching (7)
  * Merge null/pattern checks into complex pattern
      Merge into pattern (2)
  * 'if' statement can be rewritten as '?:' expression
      Convert into '?:' expression (4)
  * Convert lambda expression into method group
      Convert into method group (2)
  * Convert into 'using' declaration
      Convert into 'using' declaration (1)
  * Inline 'out' variable declaration
      Inline 'out' variable declaration (3)
  * Use 'nameof' expression when registering a DependencyProperty
      Use 'nameof' expression when registering a DependencyProperty (2)
  * Convert into lambda expression
      Use lambda expression (1)
  * Convert static method invocation into extension method call
      Invoke as extension method (4)
- Syntax Style
  * Use preferred style of 'new' expression when created type is evident
      Redundant type speification (5)
  * Use preferred body style
      Inconsistent body style: use expression body (13)
  * Adjust modifiers declaration order
      Inconsistent modifiers declaration order (1)
- Redundancies in Code
  * Redundant string interpolation
      Redundant string interpolation (1)
- Potential Code Quality Issues
  * Use collection's count property
      Replace 'Enumerable.Count()' invocation with collection count property access (1)
  * Type check and casts can be merged
      Merge cast with type check (1)
- Redundancies in Symbol Declaration
  * Class with virtual (overridable) members never inherited
      Class 'TrackNumericUpDown' has some virtual members but no inheritors
	  Class 'OctaveNumericUpDown' has some virtual members but no inheritors

HINT
- Syntax Style
  * Use preferred 'var' style
      Use 'var' (built-in types)/(simple types)/(elsewhere) (101)
  * Replace built-in type reference with a CLR type name or a keyword
      Built-in type reference is inconsistent with code style settings (2)
  * Remove redundant parentheses
      Redundant parentheses (18)
  * Replace built-in type reference with a CLR type name or a keyword in static member access expressions
      Built-in type reference is inconsistent with code style settings (2)
- Language Usage Opportunities
  * 'if-return' statement can be rewritten as 'return' statement
      Convert into 'return' statement (4)
  * Convert 'if' statement into 'switch'
      Convert 'if' statement into 'switch' statement (1)
  * Foreach loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used
      Loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used (1)
  * Loop can be converted into LINQ-expression
      Loop can be converted into LINQ-expression (6)
  * Merge null/pattern/value checks into 'or'/'and' patterns
      Merge into logical pattern (1)
  * Use compound assignment
      Convert into compound assignment (4)
  * Replace if statement with null-propagating code
      Use null propagation (1)
  * 'if-return' statement can be rewritten as 'return' statement
      Convert into 'return' statement (1)
  * Replace 'switch' statement with 'switch' expression
      Convert 'switch' statement to 'switch' expression (3)
- Redundancies in Code
  * Redundant 'object.ToString()' call for value types
      Redundant 'Object.ToString()' call for value type (9)
  * Redundant 'else' keyword
      Redundant 'else' keyword (3)
  * Redundant semicolon after type or namespace declaration
      Semicolon after enum declaration is redundant (1)
	  Semicolon after struct declaration is redundant (1)
- Common Practices and Code Improvements
  * Member can be made static (shared)
      Method 'Siren_LoadMidiFile' can be made static
	  Method 'NoteFill' can be made static
	  Method 'OnValueChanged' can be made static
	  Method 'OnOctaveValueChanged' can be made static
  * Convert local variable or field into constant
      Convert into constant (2)
  * Return type can be IEnumerable<T>
      Return type can be 'IEnumerable<string>' (1)

* Modernize & Optimize UI (Part 2)

HINT
- Syntax Style
  * Use preferred namespace body style
      Convert to file-scoped namespace (25)
  • Loading branch information
Meowchestra committed Jan 29, 2023
1 parent abbe056 commit 048d434
Show file tree
Hide file tree
Showing 38 changed files with 2,700 additions and 2,834 deletions.
97 changes: 48 additions & 49 deletions BardMusicPlayer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,65 @@
using BardMusicPlayer.Seer;
using BardMusicPlayer.Siren;

namespace BardMusicPlayer
namespace BardMusicPlayer;

/// <summary>
/// Interaction logic for "App.xaml"
/// </summary>
public partial class App
{
/// <summary>
/// Interaktionslogik für "App.xaml"
/// </summary>
public partial class App : Application
{

protected override void OnStartup(StartupEventArgs e)
{
Globals.Globals.DataPath = @"data\";
protected override void OnStartup(StartupEventArgs e)
{
Globals.Globals.DataPath = @"data\";

//init pigeon at first
BmpPigeonhole.Initialize(Globals.Globals.DataPath + @"\Configuration.json");
//init pigeon at first
BmpPigeonhole.Initialize(Globals.Globals.DataPath + @"\Configuration.json");

// var view = (MainView)View;
// LogManager.Initialize(new(view.Log));
// var view = (MainView)View;
// LogManager.Initialize(new(view.Log));

//Load the last used catalog
string CatalogFile = BmpPigeonhole.Instance.LastLoadedCatalog;
if (System.IO.File.Exists(CatalogFile))
BmpCoffer.Initialize(CatalogFile);
else
BmpCoffer.Initialize(Globals.Globals.DataPath + @"\MusicCatalog.db");
//Load the last used catalog
var CatalogFile = BmpPigeonhole.Instance.LastLoadedCatalog;
if (System.IO.File.Exists(CatalogFile))
BmpCoffer.Initialize(CatalogFile);
else
BmpCoffer.Initialize(Globals.Globals.DataPath + @"\MusicCatalog.db");

//Setup seer
BmpSeer.Instance.SetupFirewall("BardMusicPlayer");
//Start meastro before seer, else we'll not get all the players
BmpMaestro.Instance.Start();
//Start seer
BmpSeer.Instance.Start();
//Setup seer
BmpSeer.Instance.SetupFirewall("BardMusicPlayer");
//Start maestro before seer, else we'll not get all the players
BmpMaestro.Instance.Start();
//Start seer
BmpSeer.Instance.Start();

DalamudBridge.DalamudBridge.Instance.Start();
DalamudBridge.DalamudBridge.Instance.Start();

//Start the scripting
BmpScript.Instance.Start();
//Start the scripting
BmpScript.Instance.Start();

BmpSiren.Instance.Setup();
//BmpJamboree.Instance.Start();
}
BmpSiren.Instance.Setup();
//BmpJamboree.Instance.Start();
}

protected override void OnExit(ExitEventArgs e)
{
//LogManager.Shutdown();
BmpJamboree.Instance.Stop();
if (BmpSiren.Instance.IsReadyForPlayback)
BmpSiren.Instance.Stop();
BmpSiren.Instance.ShutDown();
BmpMaestro.Instance.Stop();
protected override void OnExit(ExitEventArgs e)
{
//LogManager.Shutdown();
BmpJamboree.Instance.Stop();
if (BmpSiren.Instance.IsReadyForPlayback)
BmpSiren.Instance.Stop();
BmpSiren.Instance.ShutDown();
BmpMaestro.Instance.Stop();

BmpScript.Instance.Stop();
BmpScript.Instance.Stop();

DalamudBridge.DalamudBridge.Instance.Stop();
BmpSeer.Instance.Stop();
BmpSeer.Instance.DestroyFirewall("BardMusicPlayer");
BmpCoffer.Instance.Dispose();
BmpPigeonhole.Instance.Dispose();
DalamudBridge.DalamudBridge.Instance.Stop();
BmpSeer.Instance.Stop();
BmpSeer.Instance.DestroyFirewall("BardMusicPlayer");
BmpCoffer.Instance.Dispose();
BmpPigeonhole.Instance.Dispose();

//Wasabi hangs kill it with fire
Process.GetCurrentProcess().Kill();
}
//Wasabi hangs kill it with fire
Process.GetCurrentProcess().Kill();
}
}
}
6 changes: 3 additions & 3 deletions BardMusicPlayer/Controls/BardExtSettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>

<!-- Songtitle grid -->
<!-- Song title grid -->
<Grid Grid.Row="1" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand All @@ -56,7 +56,7 @@
<Label Grid.Row="0" Grid.ColumnSpan="3" Content="Post song title:" />
<ComboBox Grid.Row="1" Grid.Column="0" x:Name="Songtitle_Chat_Type" HorizontalAlignment="Left"
VerticalAlignment="Stretch" Width="50"
SelectionChanged="Songtitle_Post_Type_SelectionChanged">
SelectionChanged="SongTitle_Post_Type_SelectionChanged">
<ComboBoxItem>say</ComboBoxItem>
<ComboBoxItem>yell</ComboBoxItem>
<ComboBoxItem>shout</ComboBoxItem>
Expand All @@ -68,7 +68,7 @@
VerticalAlignment="Top" />
<ComboBox Grid.Row="1" Grid.Column="8" x:Name="Songtitle_Post_Type" Text="AutoPost via"
HorizontalAlignment="Left" VerticalAlignment="Stretch" MinWidth="90"
SelectionChanged="Songtitle_Post_Type_SelectionChanged">
SelectionChanged="SongTitle_Post_Type_SelectionChanged">
<ComboBoxItem>off</ComboBoxItem>
<ComboBoxItem>on</ComboBoxItem>
</ComboBox>
Expand Down
Loading

0 comments on commit 048d434

Please sign in to comment.