Skip to content

Commit

Permalink
Fixed binding on AppStatus,
Browse files Browse the repository at this point in the history
Added command Line args feature
  • Loading branch information
DineshSolanki committed Aug 31, 2021
1 parent fe9181a commit 753db29
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
4 changes: 2 additions & 2 deletions FoliCon/FoliCon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyName>FoliCon</AssemblyName>
<Version>3.7.0</Version>
<Version>3.7.1</Version>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<!--<PublishTrimmed>true</PublishTrimmed>-->
<ApplicationIcon>Resources\folicon Icon.ico</ApplicationIcon>
<LangVersion>preview</LangVersion>
<PackageVersion>3.7.0</PackageVersion>
<AssemblyVersion>3.7.0.0</AssemblyVersion>
<AssemblyVersion>3.7.1.0</AssemblyVersion>
<Company>Dinesh Solanki</Company>
<Description>Creates Folder icons for Movies, Serials, Music, and Games Folders
dineshsolanki.github.io/folicon/</Description>
Expand Down
27 changes: 27 additions & 0 deletions FoliCon/Modules/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -634,5 +634,32 @@ public static int GetResultCount(bool isPickedById, dynamic result, string searc
{
return isPickedById ? result != null ? 1 : 0 : searchMode == "Game" ? result.Length : result.TotalResults;
}
public static IDictionary<string, string> GetCmdArgs()
{
IDictionary<string, string> arguments = new Dictionary<string, string>();
var args = Environment.GetCommandLineArgs();

for (var index = 1; index < args.Length; index += 2)
{
var arg = args[index].Replace("--", "");
arguments.Add(arg, args[index + 1]);
}
return arguments;
}
public static void AddToContextMenu()
{
var commandS = $@"""{Process.GetCurrentProcess().MainModule?.FileName}"" --path ""%1""";
ApplicationHelper.RegisterContextMenuToDirectory("Merge Subtitles", commandS);
commandS = $@"""{Process.GetCurrentProcess().MainModule?.FileName}"" --path ""%V""";
ApplicationHelper.RegisterContextMenuToBackground("Merge Subtitles", commandS);
//Growl.SuccessGlobal("Merge Subtitle option added to context menu!");
}

public static void RemoveFromContextMenu()
{
ApplicationHelper.UnRegisterContextMenuFromDirectory("Merge Subtitles");
ApplicationHelper.UnRegisterCascadeContextMenuFromBackground("Merge Subtitles");
//Growl.InfoGlobal("Merge Subtitle option removed from context menu!");
}
}
}
2 changes: 1 addition & 1 deletion FoliCon/ViewModels/AboutBoxViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace FoliCon.ViewModels
{
public class AboutBoxViewModel : BindableBase, IDialogAware
{
private string _title = "Folicon v3.7";
private string _title = "Folicon v3.7.1";
private string _logo = "/Resources/folicon Icon.png";

private string _description = LangProvider.GetLang("FoliConDescription");
Expand Down
16 changes: 16 additions & 0 deletions FoliCon/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,22 @@ public MainWindowViewModel(IDialogService dialogService)
.PersistOn(nameof(PropertyChanged));
Services.Tracker.Track(this);
Util.CheckForUpdate(true);
var cmdArgs = Util.GetCmdArgs();
if (!cmdArgs.ContainsKey("path")) return;
SelectedFolder = cmdArgs["path"];
var mode = cmdArgs["mode"];
if (mode != "Professional" && new List<string>()
{"Auto (Movies & TV Shows)","TV","Movie","Game"}.Contains(mode))
{
IconMode = "Poster";
SearchMode = mode;
}
else
{
IconMode = "Professional";
}
SearchAndMakeMethod();

}

private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion FoliCon/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Grid.Column="0">
<Label Content="{ex:Lang Key={Binding AppStatus}}" BorderThickness="0" />
<Label Content="{Binding AppStatus}" BorderThickness="0" />
</StatusBarItem>
<Separator Grid.Column="1" />
<StatusBarItem Grid.Column="2" HorizontalContentAlignment="Stretch">
Expand Down

0 comments on commit 753db29

Please sign in to comment.