Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/SLICAN/BzCOM
Browse files Browse the repository at this point in the history
  • Loading branch information
KWeselski committed Jan 13, 2020
2 parents c1af8ef + 500dcce commit 0e3174d
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 341 deletions.
8 changes: 0 additions & 8 deletions BzComWpf/AddressBookForm.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,10 @@
<Image Source="Images/GrafikiMenu/groupSilver.png" x:Name="Team" Stretch="None" />
</Button>

<Button Cursor="Hand" x:Name="ButtonArchive" ToolTip="Udostępnianie ekranu" Background="#151515" BorderThickness="0" Click="ButtonArchive_Click" Foreground="Black" HorizontalAlignment="Left" Width="30" Height="30" VerticalAlignment="Bottom" Margin="0,0,15,5" MouseEnter="ButtonArchive_MouseEnter" MouseLeave="ButtonArchive_MouseLeave">
<Image Source="Images/GrafikiMenu/screenSilver.png" x:Name="Archive" Stretch="None" />
</Button>



<Button Cursor="Hand" ToolTip="Informacje o programie" x:Name="ButtonFav" Background="#151515" BorderThickness="0" Click="ButtonFav_Click" Foreground="Black" HorizontalAlignment="Left" Width="30" Height="30" VerticalAlignment="Bottom" Margin="0,0,15,5" MouseEnter="ButtonFav_MouseEnter" MouseLeave="ButtonFav_MouseLeave" >
<Image Source="Images/GrafikiMenu/infoSilver.png" x:Name="UserInfo" Stretch="None"/>
</Button>



<Button Cursor="Hand" ToolTip="Wyloguj" x:Name="Logout" Background="#151515" BorderThickness="0" Click="Logout_Click" Foreground="Black" HorizontalAlignment="Left" Width="30" Height="30" VerticalAlignment="Bottom" Margin="65,0,0,5" Grid.Column="1" MouseEnter="Logout_MouseEnter" MouseLeave="Logout_MouseLeave">


Expand Down
19 changes: 0 additions & 19 deletions BzComWpf/AddressBookForm.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ public AddressBookForm()
conversationConnections = new List<ConversationPage>();
AdressBookPage adressBookPage = new AdressBookPage(messageForm, openedConnections, conversationConnections,myNumber);
conversationList = new ListConversation(messageForm, openedConnections, conversationConnections, adressBookPage.ListViewAddressBook,myNumber);
ScreenSharing screenSharing = new ScreenSharing();
informationPage = new Information();
pages.Add(adressBookPage);
pages.Add(conversationList);
pages.Add(informationPage);
pages.Add(screenSharing);

_mainFrame.Navigate(pages[0]);

Expand Down Expand Up @@ -327,10 +325,6 @@ private void ButtonTeam_Click(object sender, RoutedEventArgs e)
_mainFrame.Navigate(pages[1]);
}

private void ButtonArchive_Click(object sender, RoutedEventArgs e)
{
_mainFrame.Navigate(pages[3]);
}

private void ButtonSetting_Click(object sender, RoutedEventArgs e)
{
Expand Down Expand Up @@ -373,19 +367,6 @@ private void ButtonAdd_MouseLeave(object sender, MouseEventArgs e)
UserList.Stretch = Stretch.None;
}

private void ButtonArchive_MouseEnter(object sender, MouseEventArgs e)
{

Archive.Source = new BitmapImage(new Uri(@"/Images/GrafikiMenu/screenWhite.png", UriKind.Relative));
Archive.Stretch = Stretch.None;
}

private void ButtonArchive_MouseLeave(object sender, MouseEventArgs e)
{
Archive.Source = new BitmapImage(new Uri(@"/Images/GrafikiMenu/screenSilver.png", UriKind.Relative));
Archive.Stretch = Stretch.None;
}

private void ButtonTeam_MouseEnter(object sender, MouseEventArgs e)
{

Expand Down
7 changes: 0 additions & 7 deletions BzComWpf/BzCOMWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
<Compile Include="Information.xaml.cs">
<DependentUpon>Information.xaml</DependentUpon>
</Compile>
<Compile Include="ScreenSharing.xaml.cs">
<DependentUpon>ScreenSharing.xaml</DependentUpon>
</Compile>
<Compile Include="ListConversation.xaml.cs">
<DependentUpon>ListConversation.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -144,10 +141,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ScreenSharing.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ListConversation.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
8 changes: 6 additions & 2 deletions BzComWpf/ChatPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@

<Grid>

<ScrollViewer VerticalAlignment="Top" Height="364" Grid.Row="1" >
<ScrollViewer VerticalAlignment="Top" Height="364" Grid.Row="1" x:Name="ScrollViewerChat" >
<StackPanel VerticalAlignment="Top" x:Name="stackPanelBorder" >

<TextBlock x:Name="Chat" TextWrapping="Wrap" Foreground="Silver" FontFamily="Segoe UI Light" FontSize="14" >
Expand All @@ -137,7 +137,7 @@
<DockPanel Background="#383838" Margin="0,0,0,0">


<TextBox KeyDown="TextBoxMessage_KeyDown" x:Name="TextBoxMessage" Foreground="Silver" HorizontalAlignment="Left" FontSize="15px" TextWrapping="Wrap" BorderThickness="0" Background="#383838" Margin="4,1,0,1" Width="320"/>
<TextBox KeyDown="TextBoxMessage_KeyDown" x:Name="TextBoxMessage" Foreground="Silver" HorizontalAlignment="Left" FontSize="15px" TextWrapping="Wrap" BorderThickness="0" Background="#383838" Margin="4,1,0,1" Width="295"/>
<Button Cursor="Hand" ToolTip="Wyślij wiadomość" x:Name="sendButton" Click="Button_Click" Background="#383838" BorderThickness="0" DockPanel.Dock="Right" Width="40" MouseEnter="SendButton_MouseEnter" LostFocus="SendButton_LostFocus" MouseLeave="SendButton_MouseLeave">


Expand All @@ -154,6 +154,10 @@

</Button>

<Button Cursor="Hand" x:Name="ButtonHost" ToolTip="Udostępnianie ekranu" Background="#383838" BorderThickness="0" Margin="0,0,0,0" Width="35" Click="ButtonHost_Click" MouseEnter="ButtonHost_MouseEnter" MouseLeave="ButtonHost_MouseLeave">
<Image Source="Images/GrafikiMenu/screenSilver.png" x:Name="Archive" Stretch="None" />
</Button>

</DockPanel>
</Border>
</Grid>
Expand Down
145 changes: 142 additions & 3 deletions BzComWpf/ChatPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
using Google.Apis.Util.Store;
using Microsoft.Win32;
using Notifications.Wpf;
using RDPCOMAPILib;

namespace BzCOMWpf
{

Expand All @@ -33,6 +35,7 @@ public partial class ChatPage : Page
//private bool upload;

string szyfr = "3t6w9z$C&E)H@McQ";
string szyfr2 = "St6w9z$C&E)H@McS";
public DateTime messageSendTime; // Zmienna pod dokładny czas wysłania wiadomości.
static string[] Scopes = { DriveService.Scope.Drive };
static string ApplicationName = "BzCom";
Expand All @@ -58,6 +61,76 @@ public ChatPage(int _nr, int _myNumber)

}

#region Udostepnianie Ekranu
ScreenViewer xy;
RDPSession x = null;

private void Incoming(object Guest)
{
IRDPSRAPIAttendee MyGuest = (IRDPSRAPIAttendee)Guest;//???
MyGuest.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_INTERACTIVE;
}

private void ButtonHost_Click(object sender, RoutedEventArgs e)
{
if (x == null)
{
x = new RDPSession();
x.OnAttendeeConnected += Incoming;
x.Open();
IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10);
//ButtonHost.Visibility = Visibility.Hidden;
//ButtonStopHost.Visibility = Visibility.Visible;
if (trafficController.GetState() == State.OpenedGate)
{
messageSendTime = DateTime.Now;
/// Wysyłanie konkretnej wiadomości do kontaktu, z którym mamy otwartego gate'a
TextBoxMessage.Text = "Ekran udostępniony";
trafficController.SMSSend(nr.ToString(), null, szyfr2 + Invitation.ConnectionString, "", "" + messageSendTime);
messageSend = true;
}
}
else
{
x.Close();
x = null;
TextBoxMessage.Text = "Udostępnianie przerwane";
}
}
private void ButtonHost_MouseEnter(object sender, MouseEventArgs e)
{
//send.Source = new BitmapImage(new Uri(@"/Images/GrafikiMenu/screenSilver.png", UriKind.Relative));
//send.Stretch = Stretch.None;
}
private void ButtonHost_MouseLeave(object sender, MouseEventArgs e)
{
//clip.Source = new BitmapImage(new Uri(@"/Images/GrafikiMenu/screenSilver.png", UriKind.Relative));
// clip.Stretch = Stretch.None;
}
public void OpenViewer(string Invitation)
{
try
{
string inv = Invitation;
xy = new ScreenViewer(this);
xy.Connection(inv);// Do ogarnięcia - wychodzi poza zakres ???
xy.Show();
}
catch (ArgumentException)
{
//textBox_Link.Text = "Błędne zaproszenie";
TextBoxMessage.Text = "Błędne zaproszenie";
}
}

public void StopViewing()
{
xy.Disconnection();
xy.Close();
}

#endregion


private void LoadMessages(List<Message> messages)
{
Expand Down Expand Up @@ -103,20 +176,27 @@ private void TrafficController_OnMessageReceived(TrafficController sender, Messa
if (nr == msgNow.Number)
{
bool zawiera = false;
bool zawiera2 = false;
if (msgNow.Text.Contains(confSzyfr))
{

}
else
{
if (msgNow.Text.Contains(szyfr) || msgNow.Text.Contains("CONVERSATION")) { zawiera = true; }
if (msgNow.Text.Contains(szyfr)) { zawiera = true; } //|| msgNow.Text.Contains("CONVERSATION")
if (msgNow.Text.Contains(szyfr2)) { zawiera2 = true; } //|| msgNow.Text.Contains("CONVERSATION")
Console.WriteLine(zawiera);
if (zawiera == true)
{
msgNow.Text = msgNow.Text.Replace(szyfr, "");
TypeText(trafficController.FindName(msgNow.Number.ToString()), msgNow.Text, msgNow.DateTime, true);
}
if (zawiera == false) { TypeText(trafficController.FindName(msgNow.Number.ToString()), msgNow.Text, msgNow.DateTime); }
if (zawiera2 == true)
{
msgNow.Text = msgNow.Text.Replace(szyfr2, "");
TypeText(trafficController.FindName(msgNow.Number.ToString()), msgNow.Text, msgNow.DateTime, false, true);
}
if (zawiera == false && zawiera2 == false) { TypeText(trafficController.FindName(msgNow.Number.ToString()), msgNow.Text, msgNow.DateTime); }
}

}
Expand All @@ -133,10 +213,11 @@ private void TrafficController_OnMessageReceived(TrafficController sender, Messa
/// <param name="who"></param>
/// <param name="message"></param>
/// <param name="datatime"></param>
public void TypeText(string who, string message, DateTime datatime, bool hyper = false)
public void TypeText(string who, string message, DateTime datatime, bool hyper = false, bool inv = false)
{
//Chat.Text += who + " : " + message;
if (hyper == true) { SetHyperlink((who + ": " + datatime + "\n" + "?" + message + "\n")); }
else if (inv == true) { SetHyperlink2((who + ": " + datatime + "\n" + "?" + message + "\n")); }
else {
SetTextHTML(who + ": " + datatime + "\n" + "" + message + "\n");
}
Expand Down Expand Up @@ -191,6 +272,10 @@ private void SetTextHTML(string text)
SetTextCallBack f = new SetTextCallBack(SetTextHTML);
Dispatcher.Invoke(f, new object[] { text });
}
if (ScrollViewerChat.VerticalOffset == ScrollViewerChat.ScrollableHeight)
{
ScrollViewerChat.ScrollToEnd();
}
}


Expand Down Expand Up @@ -229,6 +314,7 @@ private void SetHyperlink(string text)
textBlock.TextWrapping = TextWrapping.Wrap;
textBlock.Inlines.Add(lines[0]);
textBlock.Inlines.Add(h);
textBlock.Inlines.Add("\n");
textBlock.Foreground = new SolidColorBrush(Colors.White);
borderOkienka.Child = textBlock;
stackPanelBorder.Children.Add(borderOkienka);
Expand All @@ -239,6 +325,59 @@ private void SetHyperlink(string text)
SetTextCallBack f = new SetTextCallBack(SetHyperlink);
Dispatcher.Invoke(f, new object[] { text });
}
if (ScrollViewerChat.VerticalOffset == ScrollViewerChat.ScrollableHeight)
{
ScrollViewerChat.ScrollToEnd();
}
}

private void SetHyperlink2(string text)
{
if (Chat.Dispatcher.Thread == Thread.CurrentThread)
{
Border borderOkienka = new Border();
if (text.Substring(0, 2) == "Ja")
{
borderOkienka.Background = new SolidColorBrush(Color.FromRgb(65, 174, 207));
borderOkienka.HorizontalAlignment = HorizontalAlignment.Right;
}
else
{
borderOkienka.Background = new SolidColorBrush(Color.FromRgb(68, 68, 68));
borderOkienka.HorizontalAlignment = HorizontalAlignment.Left;
}
borderOkienka.CornerRadius = new CornerRadius(4);
borderOkienka.BorderThickness = new Thickness(1);
string[] lines = text.Split(new Char[] { '?', '!' });
//int index = text.IndexOf("?");
//int lastindex = text.- 1;
//Console.WriteLine(index);
//string text1 = text.Substring(0, index);
//string hiperlink = text.Substring(index + 1, lastindex);
Console.WriteLine(lines[1]);
var h = new Hyperlink();
h.Inlines.Add("Udostępniam ci mój pulpit");
Console.WriteLine(lines[1]);
h.Click += (s, a) => { OpenViewer(lines[1]); };
TextBlock textBlock = new TextBlock();
textBlock.TextWrapping = TextWrapping.Wrap;
textBlock.Inlines.Add(lines[0]);
textBlock.Inlines.Add(h);
textBlock.Inlines.Add("\n");
textBlock.Foreground = new SolidColorBrush(Colors.White);
borderOkienka.Child = textBlock;
stackPanelBorder.Children.Add(borderOkienka);
}
else
{
Console.WriteLine("SetTextHTML");
SetTextCallBack f = new SetTextCallBack(SetHyperlink2);
Dispatcher.Invoke(f, new object[] { text });
}
if (ScrollViewerChat.VerticalOffset == ScrollViewerChat.ScrollableHeight)
{
ScrollViewerChat.ScrollToEnd();
}
}

// Ważna informacja względem możliwej chęci użycia userData:
Expand Down
Loading

0 comments on commit 0e3174d

Please sign in to comment.