Added Main Project
This commit is contained in:
@@ -0,0 +1,250 @@
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace TeamsNetphoneLink.WPF.MVVM
|
||||
{
|
||||
public static class StatusPanelNames
|
||||
{
|
||||
public const string TeamsLocalAPIStatus = nameof(TeamsLocalAPIStatus);
|
||||
public const string TeamsGraphAPIStatus = nameof(TeamsGraphAPIStatus);
|
||||
public const string NetphoneCLMGRStatus = nameof(NetphoneCLMGRStatus);
|
||||
public const string TeamsMeetingStatus = nameof(TeamsMeetingStatus);
|
||||
public const string NetphoneCallStatus = nameof(NetphoneCallStatus);
|
||||
}
|
||||
|
||||
public class DashboardViewModel : INotifyPropertyChanged
|
||||
{
|
||||
// Parameterloser Konstruktor
|
||||
public DashboardViewModel()
|
||||
{
|
||||
// Initialisieren Sie hier Standardwerte, falls erforderlich
|
||||
TeamsLocalAPIStatusText = "Nicht verbunden";
|
||||
TeamsLocalAPIStatusBackground = new SolidColorBrush(Colors.Red);
|
||||
TeamsGraphAPIStatusText = "Konfiguration fehlt";
|
||||
TeamsGraphAPIStatusBackground = new SolidColorBrush(Colors.Red);
|
||||
NetphoneCLMGRStatusText = "Nicht verbunden";
|
||||
NetphoneCLMGRStatusBackground = new SolidColorBrush(Colors.Red);
|
||||
TeamsMeetingStatusText = "Not Active";
|
||||
TeamsMeetingStatusBackground = new SolidColorBrush(Colors.DarkOrange);
|
||||
NetphoneCallStatusText = "Not Active";
|
||||
NetphoneCallStatusBackground = new SolidColorBrush(Colors.DarkOrange);
|
||||
|
||||
AppTitle2 = "Teams Netphone Link";
|
||||
VersionText = "Aktuell";
|
||||
VersionVisibility = Visibility.Visible;
|
||||
VersionBackground = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
|
||||
|
||||
private string _appTitle;
|
||||
|
||||
private string _versionText;
|
||||
private Visibility _versionVisibility;
|
||||
private Brush _versionBackground;
|
||||
|
||||
private string _teamsLocalAPIStatusText;
|
||||
private Brush _teamsLocalAPIStatusBackground;
|
||||
private string _teamsGraphAPIStatusText;
|
||||
private Brush _teamsGraphAPIStatusBackground;
|
||||
private string _netphoneCLMGRStatusText;
|
||||
private Brush _netphoneCLMGRStatusBackground;
|
||||
private string _teamsMeetingStatusText;
|
||||
private Brush _teamsMeetingStatusBackground;
|
||||
private string _netphoneCallStatusText;
|
||||
private Brush _netphoneCallStatusBackground;
|
||||
|
||||
public string TeamsLocalAPIStatusText
|
||||
{
|
||||
get => _teamsLocalAPIStatusText;
|
||||
set
|
||||
{
|
||||
_teamsLocalAPIStatusText = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Brush TeamsLocalAPIStatusBackground
|
||||
{
|
||||
get => _teamsLocalAPIStatusBackground;
|
||||
set
|
||||
{
|
||||
_teamsLocalAPIStatusBackground = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string TeamsGraphAPIStatusText
|
||||
{
|
||||
get => _teamsGraphAPIStatusText;
|
||||
set
|
||||
{
|
||||
_teamsGraphAPIStatusText = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Brush TeamsGraphAPIStatusBackground
|
||||
{
|
||||
get => _teamsGraphAPIStatusBackground;
|
||||
set
|
||||
{
|
||||
_teamsGraphAPIStatusBackground = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string NetphoneCLMGRStatusText
|
||||
{
|
||||
get => _netphoneCLMGRStatusText;
|
||||
set
|
||||
{
|
||||
_netphoneCLMGRStatusText = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Brush NetphoneCLMGRStatusBackground
|
||||
{
|
||||
get => _netphoneCLMGRStatusBackground;
|
||||
set
|
||||
{
|
||||
_netphoneCLMGRStatusBackground = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string TeamsMeetingStatusText
|
||||
{
|
||||
get => _teamsMeetingStatusText;
|
||||
set
|
||||
{
|
||||
_teamsMeetingStatusText = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Brush TeamsMeetingStatusBackground
|
||||
{
|
||||
get => _teamsMeetingStatusBackground;
|
||||
set
|
||||
{
|
||||
_teamsMeetingStatusBackground = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string NetphoneCallStatusText
|
||||
{
|
||||
get => _netphoneCallStatusText;
|
||||
set
|
||||
{
|
||||
_netphoneCallStatusText = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Brush NetphoneCallStatusBackground
|
||||
{
|
||||
get => _netphoneCallStatusBackground;
|
||||
set
|
||||
{
|
||||
_netphoneCallStatusBackground = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string AppTitle2
|
||||
{
|
||||
get => _appTitle;
|
||||
set
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
_appTitle = value;
|
||||
OnPropertyChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public string VersionText
|
||||
{
|
||||
get => _versionText;
|
||||
set
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
_versionText = value;
|
||||
OnPropertyChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Visibility VersionVisibility
|
||||
{
|
||||
get => _versionVisibility;
|
||||
set
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
_versionVisibility = value;
|
||||
OnPropertyChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Brush VersionBackground
|
||||
{
|
||||
get => _versionBackground;
|
||||
set
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
_versionBackground = value;
|
||||
OnPropertyChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
// Method to update status panel
|
||||
public void UpdateStatusPanel(string statusPanelName, Color color, string text)
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
// Get the type of the ViewModel
|
||||
var type = GetType();
|
||||
|
||||
// Construct property names for Text and Background
|
||||
string textPropertyName = $"{statusPanelName}Text";
|
||||
string backgroundPropertyName = $"{statusPanelName}Background";
|
||||
|
||||
// Get the properties using reflection
|
||||
PropertyInfo textProperty = type.GetProperty(textPropertyName); //CS8600
|
||||
PropertyInfo backgroundProperty = type.GetProperty(backgroundPropertyName); //CS8600
|
||||
|
||||
if (textProperty != null && backgroundProperty != null)
|
||||
{
|
||||
// Update the Text property
|
||||
textProperty.SetValue(this, text);
|
||||
|
||||
// Update the Background property
|
||||
backgroundProperty.SetValue(this, new SolidColorBrush(color));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException($"Invalid status panel name: {statusPanelName}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using Emoji.Wpf;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Effects;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace TeamsNetphoneLink.WPF.MVVM
|
||||
{
|
||||
public class FinishPanelViewModel : INotifyPropertyChanged
|
||||
{
|
||||
// Parameterloser Konstruktor
|
||||
public FinishPanelViewModel()
|
||||
{
|
||||
// Initialisieren Sie hier Standardwerte, falls erforderlich
|
||||
FinishPanelEnabled = false;
|
||||
FinishPanelFinishTextColor = new SolidColorBrush(Colors.DarkOrange);
|
||||
FinishPanelFinishTextText = "Authentifizierung ausstehend...";
|
||||
FinishPanelEffect = new TintEffect { Tint = Colors.DarkGray };
|
||||
}
|
||||
|
||||
private bool _finishPanelEnabled;
|
||||
private Brush _finishPanelFinishTextColor;
|
||||
private string _finishPanelFinishTextText;
|
||||
private Effect _finishPanelEffect;
|
||||
|
||||
public bool FinishPanelEnabled
|
||||
{
|
||||
get => _finishPanelEnabled;
|
||||
set
|
||||
{
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
_finishPanelEnabled = value;
|
||||
OnPropertyChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Brush FinishPanelFinishTextColor
|
||||
{
|
||||
get => _finishPanelFinishTextColor;
|
||||
set
|
||||
{
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
_finishPanelFinishTextColor = value;
|
||||
OnPropertyChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public string FinishPanelFinishTextText
|
||||
{
|
||||
get => _finishPanelFinishTextText;
|
||||
set
|
||||
{
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
_finishPanelFinishTextText = value;
|
||||
OnPropertyChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Effect FinishPanelEffect
|
||||
{
|
||||
get => _finishPanelEffect;
|
||||
set
|
||||
{
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
_finishPanelEffect = value;
|
||||
OnPropertyChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFinishPanelFinishTextColor(Color color)
|
||||
{
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
FinishPanelFinishTextColor = new SolidColorBrush((Color)color);
|
||||
});
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
|
||||
|
||||
namespace TeamsNetphoneLink.WPF.MVVM
|
||||
{
|
||||
public class LogEntry
|
||||
{
|
||||
public DateTime Time { get; set; }
|
||||
public string Subsystem { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
public class LogViewModel : INotifyPropertyChanged
|
||||
{
|
||||
// Collection to hold log entries
|
||||
public ObservableCollection<LogEntry> LogEntries { get; } = new ObservableCollection<LogEntry>();
|
||||
|
||||
// Add a log entry
|
||||
public void AddLogEntry(string entry)
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
LogEntries.Add(new LogEntry { Time = DateTime.Now, Type = "Info", Subsystem = "NONE", Message = entry });
|
||||
});
|
||||
}
|
||||
|
||||
// Add a log entry
|
||||
public void AddLogEntry(string subsystem, string entry)
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
LogEntries.Add(new LogEntry { Time = DateTime.Now, Type = "Info", Subsystem = subsystem, Message = entry });
|
||||
});
|
||||
}
|
||||
|
||||
// Add a log entry
|
||||
public void AddLogEntry(string type, string subsystem, string entry)
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
LogEntries.Add(new LogEntry { Time = DateTime.Now, Type = type, Subsystem = subsystem, Message = entry });
|
||||
});
|
||||
}
|
||||
|
||||
public void AddLogEntry(DateTime time, string subsystem, string message)
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
LogEntries.Add(new LogEntry { Time = time, Type = "Info", Subsystem = subsystem, Message = message });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Clear all log entries
|
||||
public void ClearLogEntries()
|
||||
{
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
LogEntries.Clear();
|
||||
});
|
||||
}
|
||||
|
||||
// Implement INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user