private void call_ContextMenuOpened(object sender, RoutedEventArgs e)
{
ContextMenu menu = sender as ContextMenu;
menu.Items.Clear();
MenuItem item;
if (call_ended) {
menu.Items.Add(CreateMenuItem("Remove Call From History", RemoveCallFromHistory));
menu.Items.Add(CreateMenuItem("Call on Account " + account.name, create_outgoing_call));
}
else {
if (am_recording_file != null)
menu.Items.Add(CreateMenuItem("Stop Recording Call", StopRecordCall));
else if (broker.recordings_folder != null)
menu.Items.Add(CreateMenuItem("Record Call", RecordCall));
menu.Items.Add(CreateMenuItem("Transfer", TransferPrompt));
menu.Items.Add(CreateMenuItem("Conference", ConferenceAdd));
item = new MenuItem() { Header = "Their Volume" };
for (int x = -4; x <= 4; x++) {
int val = x;
item.Items.Add(CreateMenuItem("Level " + x + (other_audio_level == x ? "*" : ""), () => SetOtherPartyAudioLevel(val)));
}
menu.Items.Add(item);
item = new MenuItem() { Header = "Your Volume" };
for (int x = -4; x <= 4; x++) {
int val = x;
item.Items.Add(CreateMenuItem("Level " + x + (our_audio_level == x ? "*" : ""), () => SetOurAudioLevel(val)));
}
menu.Items.Add(item);
menu.Items.Add(CreateMenuItem("End Call", hangup));
}
if (!String.IsNullOrWhiteSpace(dtmfs))
menu.Items.Add(CreateMenuItem("Remove Call DTMF Presses", () => { dtmfs = ""; }));
if (CallRightClickMenuShowing != null) {
CallRightClickMenuShowing(this, new CallRightClickEventArgs { call = this, menu = menu });
}
}