Skip to content

Commit

Permalink
update CallUserById example
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariia Khrapunova committed Jan 11, 2018
1 parent 0497ebe commit dea6a84
Show file tree
Hide file tree
Showing 65 changed files with 42,527 additions and 23 deletions.
Binary file not shown.
Empty file.
Binary file not shown.
Expand Up @@ -32,8 +32,29 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down Expand Up @@ -74,6 +95,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 65 additions & 12 deletions Windows/csharp-examples/CallUserById/DemoCallUserById/Form1.cs
Expand Up @@ -6,6 +6,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Helpers;
using System.Windows.Forms;

namespace DemoSDK
Expand All @@ -15,24 +16,71 @@ public partial class Form1 : Form
public static string ServerName;
public static string TrueConf_Id;
public static string TrueConf_Password;
private bool isCanCall = false; //flag means the CallX can make calls
private bool started = false; //flag means that TrueConf CallX started
private bool isCalling; //flag means the CallX is calling now

public Form1()
{
Auth auth = new Auth(); //open authorization dialog after form is initialized
auth.ShowDialog(); //open authorization dialog after form is initialized
InitializeComponent();
InitializeComponent();
axTrueConfCallX1.OnServerConnected += axTrueConfCallX1_OnServerConnected; //handle OnServerConnected event
axTrueConfCallX1.OnXAfterStart += axTrueConfCallX1_OnXAfterStart; //handle OnXAfterStart event
axTrueConfCallX1.OnXLogin += axTrueConfCallX1_OnXLogin; //handle OnXLogin event
axTrueConfCallX1.OnXLoginError += axTrueConfCallX1_OnXLoginError; //handle OnXLoginError event
axTrueConfCallX1.OnConferenceCreated += axTrueConfCallX1_OnConferenceCreated; //handle OnConferenceCreated event
axTrueConfCallX1.OnInviteReceived += AxTrueConfCallX1_OnInviteReceived; //handle OnInviteReceived event
axTrueConfCallX1.OnServerDisconnected += AxTrueConfCallX1_OnServerDisconnected; //handle OnServerDisconnected event
axTrueConfCallX1.OnLogout += AxTrueConfCallX1_OnLogout; //handle OnLogout event
axTrueConfCallX1.OnConferenceDeleted += AxTrueConfCallX1_OnConferenceDeleted; //handle OnConferenceDeleted event
}

private void AxTrueConfCallX1_OnConferenceDeleted(object sender, AxTrueConf_CallXLib._ITrueConfCallXEvents_OnConferenceDeletedEvent e)
{
toolStripStatusConference.Text = "Not in conference";
}

private void AxTrueConfCallX1_OnLogout(object sender, AxTrueConf_CallXLib._ITrueConfCallXEvents_OnLogoutEvent e)
{
toolStripStatusLogin.Text = "Not logged in";
}

private void AxTrueConfCallX1_OnServerDisconnected(object sender, AxTrueConf_CallXLib._ITrueConfCallXEvents_OnServerDisconnectedEvent e)
{
toolStripStatusServer.Text = "Not connected";
}

private void AxTrueConfCallX1_OnInviteReceived(object sender, AxTrueConf_CallXLib._ITrueConfCallXEvents_OnInviteReceivedEvent e)
{
dynamic data = Json.Decode(e.eventDetails); //get information about incoming call from JSON data
string message = "";
switch (data.type)
{
case 0: //type 0 - peer-to-peer call
message = "Do you want accept call from ";
break;
case 1: //type 1 - conference
message = "Do you want accept invite to conference from ";
break;
}
DialogResult result = MessageBox.Show(message + data.peerId + "?", "Incoming call", MessageBoxButtons.YesNo); //ask user
if (result == DialogResult.Yes)
axTrueConfCallX1.accept(); //if user says "Yes" - accept incoming call
else
axTrueConfCallX1.reject();// else - reject incoming call
}

private void axTrueConfCallX1_OnServerConnected(object sender, AxTrueConf_CallXLib._ITrueConfCallXEvents_OnServerConnectedEvent e) //notification about success connection to server
{
MessageBox.Show("Connect to server ok!");
toolStripStatusServer.Text = "Connected to " + ServerName; //show server status
if(!String.IsNullOrEmpty(TrueConf_Id) && !String.IsNullOrEmpty(TrueConf_Password))
axTrueConfCallX1.login(TrueConf_Id, TrueConf_Password); //login on TrueConf Server with login and password
}
private void axTrueConfCallX1_OnXLoginOk(object sender, EventArgs e) //notification about successed login
private void axTrueConfCallX1_OnXLogin(object sender, EventArgs e) //notification about successed login
{
MessageBox.Show("Login ok!"); //show message about successed login
isCanCall = true; //flag means the CallX can make calls
Enabled = true;
toolStripStatusLogin.Text = "You are logged in as " + TrueConf_Id; //show login status
isCalling = false; //flag means the CallX can make calls
for (int i = 0; i < axTrueConfCallX1.XGetCameraCount(); i++)
comboBoxCameras.Items.Add(axTrueConfCallX1.XGetCameraByIndex(i)); //get cameras and put them to combobox
for (int i = 0; i < axTrueConfCallX1.XGetMicCount(); i++)
Expand All @@ -42,14 +90,18 @@ public Form1()
}
private void axTrueConfCallX1_OnXLoginError(object sender, AxTrueConf_CallXLib._ITrueConfCallXEvents_OnXLoginErrorEvent e)
{
MessageBox.Show("Login error!"); //show message about error login
toolStripStatusLogin.Text = "Login error!"; //show login status
Auth auth = new Auth(); //open authorization dialog again
auth.ShowDialog();
}
private void axTrueConfCallX1_OnXAfterStart(object sender, EventArgs e)
{
started = true; //flag means TrueConf CallX started
if(ServerName != null)
toolStripStatusServer.Text = "Not connected";
toolStripStatusLogin.Text = "Not logged in";
toolStripStatusConference.Text = "Not in conference";
Enabled = false;
if (ServerName != null)
{
axTrueConfCallX1.connectToServer(ServerName); //after start connect to the server/service
}
Expand All @@ -71,24 +123,25 @@ private void comboBoxSpeakers_SelectedIndexChanged(object sender, EventArgs e)
}
private void buttonCall_Click(object sender, EventArgs e)
{
if (textBoxTrueConfIdForCall.Text != "" && isCanCall) //if trueconf id entered, and CallX is connected to server and authorized and isn't in call or conference
if (textBoxTrueConfIdForCall.Text != "" && !isCalling) //if trueconf id entered, and CallX is connected to server and authorized and isn't in call or conference
{
isCalling = true;
axTrueConfCallX1.call(textBoxTrueConfIdForCall.Text); //call the entered user
textBoxTrueConfIdForCall.Text = ""; //clear the textbox
}
}
private void buttonEndCall_Click(object sender, EventArgs e)
{
if (!isCanCall) //if Callx is in call
if (isCalling) //if Callx is in call
{
axTrueConfCallX1.hangUp(); //end the call
isCanCall = true; //and set that the CallX can make the calls
isCalling = false; //and set that the CallX can make the calls
}
}

private void axTrueConfCallX1_OnConferenceCreated(object sender, AxTrueConf_CallXLib._ITrueConfCallXEvents_OnConferenceCreatedEvent e)
{
isCanCall = false; //set that CallX cannot make calls
toolStripStatusConference.Text = "In conference"; //show conference status
}
}
}
Expand Up @@ -125,4 +125,7 @@
AAAAAQAAAAAAAAAAAAAAAAwAAAAADAAA2BMAANgTAAAL
</value>
</data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit dea6a84

Please sign in to comment.