Halyri - Häke  0.9
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
Hake_WPF.MainWindow Class Reference

Interaction logic for MainWindow.xaml. User can ask information from mobile client: video and location. Or user can send tutorials. Also user can manage assigments here that are shown in listbox and in map by pushpins. All controls is here in mainwindow. More...

Inheritance diagram for Hake_WPF.MainWindow:

Public Member Functions

 MainWindow ()
 Initializes components and focuses map. Also connects to server by endpointAddress that is in settings or by default. Then adds eventhandlers and informs user if conenction is not established in case there is some problem. Also starts Pinger that pings server. More...
 
void InitializeComponent ()
 InitializeComponent More...
 
void InitializeComponent ()
 InitializeComponent More...
 

Protected Member Functions

override void OnClosing (System.ComponentModel.CancelEventArgs e)
 Disconnects before closing program. Also if mapwindows or/and settingswindow is open, closes those too. More...
 

Private Member Functions

void mapController_MapWindowClosingEvent ()
 Enables MapTopOwnWindowButton when MapWindow is closing. More...
 
void MapToOwnWindow_Click (object sender, RoutedEventArgs e)
 Clears everything from map and disposes it. Then makes new window and makes the same map to it. Disables button and adds eventhandler for closing window that it can be put back to same place. More...
 
void CenterMapButton_Click (object sender, RoutedEventArgs e)
 Centers map to what ever listbox Assigment is selected or none if not selected. More...
 
void connection_AssigmentUpdatedEvent (ObservableCollection< Assignment > newConnections)
 Replaces assignments with a new assignment if there is one already with same guid. If there is not assignment with the guid, adds new assignment to assignments. If location is set, adds pushpin. If locationtype is set to userspecified takes old location from previous assignment and adds its puhspin so it disapear. Also displays textmessages if there is any. More...
 
void AssignmentsListBox_SelectionChanged (object sender, SelectionChangedEventArgs e)
 If no assignment is selected -> returns. If user is handling a assignment sets assingmentlistbox selection to old one and returns so user cannot change selection while assignment is active. Also centers map when assigmentslistbox selection is changed. If selecteditem has location it enables centermapbutton. Also clears chat and loads selected assignments chat messages. Also clears videoplayer and ekg canvas. More...
 
void HandleAssigment_Click (object sender, RoutedEventArgs e)
 If there is none selected in assignmentlistbox, shows messagebox that informs user to select one. Switch HandleAssignmentButton and handlleassignmentmennuitem content and click handler to vice versa. State changing happens in own thread so it won't block ui thread. Enables buttons that can now be used. More...
 
void UnHandleAssignmentButton_Click (object sender, RoutedEventArgs e)
 Switch HandleAssignmentButton content and click handler to vice versa. State changing happens in own thread so it won't block ui thread. Disables buttons that user cannot use when assingment is not active. More...
 
void GetMobileUserLocationButton_Click (object sender, RoutedEventArgs e)
 Asks connection to show map for mobile client. More...
 
void GetVideoButton_Click (object sender, RoutedEventArgs e)
 Switch getVideoButton content and click handler and to vice versa. More...
 
void StopVideoButton_Click (object sender, RoutedEventArgs e)
 Switch getVideoButton content and click handler and to vice versa. More...
 
void ChangeAssigmentPriority_Click (object sender, RoutedEventArgs e)
 Tries first cast sender to comboboxitem and from its tag cast it to priority and then ask connection to update it. If cast to comboboxitem fails it tries to cast it to menuitem and tries same again. More...
 
void RequestMeasurementDataFromDevice_Click (object sender, RoutedEventArgs e)
 Requests measurement data from remote device and moves to cancel request state. If ekg expander is collapsed -> expands it. More...
 
void CancelMeasurementDataFromDevice_Click (object sender, RoutedEventArgs e)
 Request cancel from mobile client and returns to request start mode. More...
 
void MeasurementDataReceived (object sender, EventArgs e, MeasurementInstrumentDto instrument, byte[] measurementData, int dataSamplesPerSecond)
 Adds points to graph from bytes array and scrolls to end of it. More...
 
void ChatSendButton_Click (object sender, RoutedEventArgs e)
 Only works if chattextbox is not empty and there is active assignment if not, returns. This just sends message to mobile client and then clears input box. More...
 
void IncomingPictureHandler (object sender, byte[] image)
 Displays the incoming "video" pictures from the mobile emergency client in the Image named ImageElement defined in the MainWindow.xaml More...
 
void ChatTextBox_KeyUp (object sender, KeyEventArgs e)
 If key pressed is enter clicks chats send button. More...
 
void RotateVideoToLeftButton_Click (object sender, RoutedEventArgs e)
 Transforms imageElemnt center point to origo and then rotates it 90 degrees and then transforms it back to same x,y position. More...
 
void RotateVideoToRightButton_Click (object sender, RoutedEventArgs e)
 Transforms imageElemnt center point to origo and then rotates it -90 degrees and then transforms it back to same x,y position. More...
 
void SettingsMenuItem_Click (object sender, RoutedEventArgs e)
 Opens settings window. More...
 
void MeasurementDataExpander_Collapsed (object sender, RoutedEventArgs e)
 Changes expander header to "avaa". More...
 
void MeasurementDataExpander_Expanded (object sender, RoutedEventArgs e)
 Changes expander header to "piilota". More...
 
void
System.Windows.Markup.IComponentConnector. 
Connect (int connectionId, object target)
 
void
System.Windows.Markup.IComponentConnector. 
Connect (int connectionId, object target)
 

Private Attributes

ObservableCollection< Assignmentassignments = new ObservableCollection<Assignment>()
 
Assignment ownAssignment
 
Connection connection
 
AudioVideoTransferManager audioVideoManager
 
bool assigmentActive = false
 
Graph measurementGraph
 
Settings settings = new Settings()
 
int angle = 0
 
SettingsWindow settingsWindow
 
MapController mapController = new MapController()
 
bool isVideoPlaying = false
 
bool isMeasurementPlaying = false
 
bool FirstMeasurementPacket = true
 
bool _contentLoaded
 

Detailed Description

Interaction logic for MainWindow.xaml. User can ask information from mobile client: video and location. Or user can send tutorials. Also user can manage assigments here that are shown in listbox and in map by pushpins. All controls is here in mainwindow.

MainWindow

<author>Atte Söderlund</author>

Constructor & Destructor Documentation

Hake_WPF.MainWindow.MainWindow ( )

Initializes components and focuses map. Also connects to server by endpointAddress that is in settings or by default. Then adds eventhandlers and informs user if conenction is not established in case there is some problem. Also starts Pinger that pings server.

Member Function Documentation

void Hake_WPF.MainWindow.AssignmentsListBox_SelectionChanged ( object  sender,
SelectionChangedEventArgs  e 
)
private

If no assignment is selected -> returns. If user is handling a assignment sets assingmentlistbox selection to old one and returns so user cannot change selection while assignment is active. Also centers map when assigmentslistbox selection is changed. If selecteditem has location it enables centermapbutton. Also clears chat and loads selected assignments chat messages. Also clears videoplayer and ekg canvas.

void Hake_WPF.MainWindow.CancelMeasurementDataFromDevice_Click ( object  sender,
RoutedEventArgs  e 
)
private

Request cancel from mobile client and returns to request start mode.

<author>Niko Mononen</author>

void Hake_WPF.MainWindow.CenterMapButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Centers map to what ever listbox Assigment is selected or none if not selected.

void Hake_WPF.MainWindow.ChangeAssigmentPriority_Click ( object  sender,
RoutedEventArgs  e 
)
private

Tries first cast sender to comboboxitem and from its tag cast it to priority and then ask connection to update it. If cast to comboboxitem fails it tries to cast it to menuitem and tries same again.

void Hake_WPF.MainWindow.ChatSendButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Only works if chattextbox is not empty and there is active assignment if not, returns. This just sends message to mobile client and then clears input box.

void Hake_WPF.MainWindow.ChatTextBox_KeyUp ( object  sender,
KeyEventArgs  e 
)
private

If key pressed is enter clicks chats send button.

void System.Windows.Markup.IComponentConnector. Hake_WPF.MainWindow.Connect ( int  connectionId,
object  target 
)
private
void System.Windows.Markup.IComponentConnector. Hake_WPF.MainWindow.Connect ( int  connectionId,
object  target 
)
private
void Hake_WPF.MainWindow.connection_AssigmentUpdatedEvent ( ObservableCollection< Assignment newConnections)
private

Replaces assignments with a new assignment if there is one already with same guid. If there is not assignment with the guid, adds new assignment to assignments. If location is set, adds pushpin. If locationtype is set to userspecified takes old location from previous assignment and adds its puhspin so it disapear. Also displays textmessages if there is any.

Parameters
newConnectionsObservablecollection of new connections
void Hake_WPF.MainWindow.GetMobileUserLocationButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Asks connection to show map for mobile client.

void Hake_WPF.MainWindow.GetVideoButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Switch getVideoButton content and click handler and to vice versa.

void Hake_WPF.MainWindow.HandleAssigment_Click ( object  sender,
RoutedEventArgs  e 
)
private

If there is none selected in assignmentlistbox, shows messagebox that informs user to select one. Switch HandleAssignmentButton and handlleassignmentmennuitem content and click handler to vice versa. State changing happens in own thread so it won't block ui thread. Enables buttons that can now be used.

void Hake_WPF.MainWindow.IncomingPictureHandler ( object  sender,
byte[]  image 
)
private

Displays the incoming "video" pictures from the mobile emergency client in the Image named ImageElement defined in the MainWindow.xaml

<author>Veli-Mikko Puupponen</author>

Parameters
imageImage of any common format in a byte array
void Hake_WPF.MainWindow.InitializeComponent ( )

InitializeComponent

void Hake_WPF.MainWindow.InitializeComponent ( )

InitializeComponent

void Hake_WPF.MainWindow.mapController_MapWindowClosingEvent ( )
private

Enables MapTopOwnWindowButton when MapWindow is closing.

void Hake_WPF.MainWindow.MapToOwnWindow_Click ( object  sender,
RoutedEventArgs  e 
)
private

Clears everything from map and disposes it. Then makes new window and makes the same map to it. Disables button and adds eventhandler for closing window that it can be put back to same place.

void Hake_WPF.MainWindow.MeasurementDataExpander_Collapsed ( object  sender,
RoutedEventArgs  e 
)
private

Changes expander header to "avaa".

void Hake_WPF.MainWindow.MeasurementDataExpander_Expanded ( object  sender,
RoutedEventArgs  e 
)
private

Changes expander header to "piilota".

void Hake_WPF.MainWindow.MeasurementDataReceived ( object  sender,
EventArgs  e,
MeasurementInstrumentDto  instrument,
byte[]  measurementData,
int  dataSamplesPerSecond 
)
private

Adds points to graph from bytes array and scrolls to end of it.

<author>Niko Mononen</author>

Parameters
instrumentWhere we want measurementdata
measurementDataThe data
dataSamplesPerSecondSamples per second
override void Hake_WPF.MainWindow.OnClosing ( System.ComponentModel.CancelEventArgs  e)
protected

Disconnects before closing program. Also if mapwindows or/and settingswindow is open, closes those too.

void Hake_WPF.MainWindow.RequestMeasurementDataFromDevice_Click ( object  sender,
RoutedEventArgs  e 
)
private

Requests measurement data from remote device and moves to cancel request state. If ekg expander is collapsed -> expands it.

<author>Niko Mononen</author>

void Hake_WPF.MainWindow.RotateVideoToLeftButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Transforms imageElemnt center point to origo and then rotates it 90 degrees and then transforms it back to same x,y position.

void Hake_WPF.MainWindow.RotateVideoToRightButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Transforms imageElemnt center point to origo and then rotates it -90 degrees and then transforms it back to same x,y position.

void Hake_WPF.MainWindow.SettingsMenuItem_Click ( object  sender,
RoutedEventArgs  e 
)
private

Opens settings window.

void Hake_WPF.MainWindow.StopVideoButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Switch getVideoButton content and click handler and to vice versa.

void Hake_WPF.MainWindow.UnHandleAssignmentButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Switch HandleAssignmentButton content and click handler to vice versa. State changing happens in own thread so it won't block ui thread. Disables buttons that user cannot use when assingment is not active.

Member Data Documentation

bool Hake_WPF.MainWindow._contentLoaded
private
int Hake_WPF.MainWindow.angle = 0
private
bool Hake_WPF.MainWindow.assigmentActive = false
private
ObservableCollection<Assignment> Hake_WPF.MainWindow.assignments = new ObservableCollection<Assignment>()
private
AudioVideoTransferManager Hake_WPF.MainWindow.audioVideoManager
private
Connection Hake_WPF.MainWindow.connection
private
bool Hake_WPF.MainWindow.FirstMeasurementPacket = true
private
bool Hake_WPF.MainWindow.isMeasurementPlaying = false
private
bool Hake_WPF.MainWindow.isVideoPlaying = false
private
MapController Hake_WPF.MainWindow.mapController = new MapController()
private
Graph Hake_WPF.MainWindow.measurementGraph
private
Assignment Hake_WPF.MainWindow.ownAssignment
private
Settings Hake_WPF.MainWindow.settings = new Settings()
private
SettingsWindow Hake_WPF.MainWindow.settingsWindow
private

The documentation for this class was generated from the following files: