initial push of android app and bt server. these are used to make a remote usable via phone

This commit is contained in:
Elias Quinn
2025-06-30 07:53:58 +01:00
parent 9e5b7a6999
commit 654af164ab
2009 changed files with 102252 additions and 2084 deletions

View File

@@ -5,7 +5,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vlc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
Title="MainWindow" Height="450" Width="800"
KeyUp="Key_Up">
<Grid>
<!-- Layout Definitions -->
<Grid.ColumnDefinitions>
@@ -164,7 +165,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Background="#222">
<TextBlock Text="Titel" Foreground="White" FontSize="16" Margin="10"/>
<TextBlock Name="title" Text="Titel" Foreground="White" FontSize="16" Margin="10"/>
<Button Content="⏮" Width="40" Margin="10" Click="OnItemPriorButtonClick"/>
<Button Content="▶" Width="40" Margin="10" Click="OnItemPauseBtn_Click"/>
<Button Content="⏭" Width="40" Margin="10" Click="OnItemNextButtonClick"/>

View File

@@ -1,25 +1,28 @@
using System.Collections.Concurrent;
using file_finder__test;
using LibVLCSharp.Shared;
using ModuleManager.Modules;
using NotVPR_SideProjecktForVpr_FreeTime;
using ShadowStream;
using ShadowStream.LogHelper;
using ShadowStream.Modules;
using ShadowStream.Obejeckte;
using ShadowStream.ObjecktForJason;
using ShadowStream.Views;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Net.Mime;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using file_finder__test;
using ShadowStream;
using ShadowStream.LogHelper;
using ShadowStream.Obejeckte;
using ShadowStream.ObjecktForJason;
using ShadowStream.Modules;
using LibVLCSharp.Shared;
using ModuleManager.Modules;
using System.Windows.Threading;
using Brushes = System.Windows.Media.Brushes;
using Color = System.Windows.Media.Color;
using File = System.IO.File;
using Path = System.IO.Path;
using System.Text.RegularExpressions;
using System.Windows.Threading;
using ShadowStream.Views;
using Point = System.Windows.Point;
@@ -90,6 +93,7 @@ public partial class MainWindow : Window
//Begin Login Process
var login = new LogIn();
login.Show();
//login.Owner = this;
Favorites = new Catagory("Favorites",Favorites_Home);
#endregion
@@ -112,7 +116,11 @@ public partial class MainWindow : Window
_progressTimer.Tick += ProgressTimer_Tick;
#endregion
#region BlutuethLogic
InitBluetoothServer();
#endregion
#region only exdend. no remuving of code
//adding all extensions... example values added
@@ -143,7 +151,7 @@ public partial class MainWindow : Window
}
//Quinn
#region dont change
//reminder to self. if issue acures. check if anyone changed folder names
//reminder to self. if issue acures. check if anyone changed folder names/or if paths are being refrenced wrongly
#region ScannLogic
@@ -386,7 +394,7 @@ public partial class MainWindow : Window
tmpBP.Add(Serie);
tmpBP.Add(Photo);
tmpBP.Add(Music);
popupWindow = new PlaylistEditor(tmpBP,false);
popupWindow = new PlaylistEditor(tmpBP,false,false);
popupWindow.Owner = this;
popupWindow.ShowInTaskbar = false;
popupWindow.Show();
@@ -399,7 +407,7 @@ public partial class MainWindow : Window
tmpBP.Add(Serie);
tmpBP.Add(Photo);
tmpBP.Add(Music);
popupWindow = new PlaylistEditor(tmpBP,true);
popupWindow = new PlaylistEditor(tmpBP,true,true,Favorites);
popupWindow.Owner = this;
popupWindow.ShowInTaskbar = false;
popupWindow.Show();
@@ -621,10 +629,10 @@ public partial class MainWindow : Window
var duration = media.Duration;
Console.WriteLine(duration);
videoSliderInit(duration / 1000);
title.Text=Path.GetFileNameWithoutExtension(filePath);
});
}
};
media.Parse(MediaParseOptions.ParseLocal);
_mediaPlayer.Play(media);
}
@@ -691,6 +699,7 @@ public partial class MainWindow : Window
}
Media media = null;
int newIndex =0;
if (next)
{
@@ -703,7 +712,7 @@ public partial class MainWindow : Window
}
if (!next)
{
int newIndex = (tmp - 1 >= 0) ? tmp - 1 : items.Count - 1; // wrap around
newIndex = (tmp - 1 >= 0) ? tmp - 1 : items.Count - 1; // wrap around
var link = items[newIndex]?.getLink();
Console.WriteLine(link);
if (!string.IsNullOrEmpty(link))
@@ -712,7 +721,10 @@ public partial class MainWindow : Window
if (media != null)
{
_mediaPlayer.Play(media);
title.Text = items[newIndex].Name.ToString();
}
else
MessageBox.Show("Could not load media. Media or link is null.");
}
@@ -831,8 +843,50 @@ public partial class MainWindow : Window
ScrollContentPlaylist.Visibility = Visibility.Visible;
}
#region tvRemote
BluetoothServer Server1;
private void InitBluetoothServer()
{
Server1 = new BluetoothServer();
Server1.ClientConnected += () =>
{
Dispatcher.Invoke(() =>
{
MessageBox.Show("🔗 Client connected!");
});
};
Server1.MessageReceived += (msg) =>
{
Dispatcher.Invoke(() =>
{
MessageBox.Show($"📨 Message: {msg.Trim()}");
});
// Optional: echo back the message
Server1.SendMessage("Echo: " + msg.Trim());
};
Server1.ErrorOccurred += (err) =>
{
Dispatcher.Invoke(() =>
{
MessageBox.Show($"⚠️ Error: {err}");
});
};
// Start server in background
new Thread(() => Server1.Init())
{
IsBackground = true
}.Start();
}
#endregion
#endregion
#endregion
#region Menue
@@ -1115,6 +1169,7 @@ public partial class MainWindow : Window
Slider slider = sender as Slider;
int value = Convert.ToInt32(slider.Value);
_mediaPlayer.Volume = value;
Server1.SendMessage("Vol=" + value);
log.Log("VolumeChanged");
}
}
@@ -1124,7 +1179,7 @@ public partial class MainWindow : Window
#region progress slider
private void ItemProgress_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (itemProgress.IsMouseOver)
if (itemProgress.IsMouseOver&&(itemProgress.Value>_mediaPlayer.Time/1000+2||itemProgress.Value<_mediaPlayer.Time/1000-2))
{
ProgressBarValueChange();
}
@@ -1133,7 +1188,7 @@ public partial class MainWindow : Window
{
itemProgress.Value = timeStap/1000;
itemProgressVisual.Value = itemProgress.Value;
Server1.SendMessage("Progress="+itemProgress.Value);
}
private void ProgressBarValueChange()
{
@@ -1186,6 +1241,35 @@ public partial class MainWindow : Window
_progressTimer.Stop();
}
private void Key_Up(object sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.Left:_mediaPlayer.Time=_mediaPlayer.Time-10000;break;
case Key.Right:_mediaPlayer.Time=_mediaPlayer.Time+10000;break;
case Key.Space:
if (_mediaPlayer.IsPlaying)
_mediaPlayer.Pause();
else
_mediaPlayer.Play();
break;
case Key.Escape:
var result = MessageBox.Show(
"Do you want to quit?",
"Exit",
MessageBoxButton.YesNo,
MessageBoxImage.Question
);
if (result == MessageBoxResult.Yes)
{
Application.Current.Shutdown();
}
break;
}
}
#endregion
}

View File

@@ -16,11 +16,24 @@ namespace ShadowStream.Views
//private unsafe Catagory* _sharedListLock;
Catagory _selectedCatagory;
Catagory existingCatagory;
public PlaylistEditor(ObservableCollection<Catagory> sharedList,bool isFaF)
public PlaylistEditor(ObservableCollection<Catagory> sharedList,bool isFaF,bool edit,Catagory? existingPlaylist = null)
{
InitializeComponent();
_sharedList = sharedList;
if (edit == true)
{
this.existingCatagory = existingPlaylist;
this.Title = "Edit Playlist";
}
else
{
this.existingCatagory = null;
this.Title = "Create Playlist";
}
if (isFaF)
{
PlaylistNameBox.Text = "Favorit";
@@ -44,6 +57,18 @@ namespace ShadowStream.Views
btn.Visibility = Visibility.Collapsed;
ItemDataGrid.Visibility = Visibility.Visible;
add_btn.Visibility = Visibility.Visible;
if (existingCatagory != null)
{
foreach (var VARIABLE in selected.getAllItems())
{
foreach (var item in existingCatagory.getAllItems())
{
if(VARIABLE.Name == item.Name)
VARIABLE.IsAdded=true;
}
}
}
ItemDataGrid.ItemsSource = selected.getAllItems();
}
else