Represents an instance of toxav.
Inheritance: IDisposable
Esempio n. 1
0
        public ToxCall(ToxAv toxav, int callindex, int friendnumber)
        {
            this.toxav = toxav;
            this.FriendNumber = friendnumber;

            callIndex = callindex;
        }
Esempio n. 2
0
        public void SetCurrent(ExtendedTox tox)
        {
            _toxAv?.Dispose();

            _toxAv = new ToxAv(tox);

            RegisterHandlers();
        }
Esempio n. 3
0
        public void Remove(ToxAv tox, EventHandler <TEventArgs> handler)
        {
            if ([email protected]().Length == 1)
            {
                this.register(tox.AvHandle, null);
                this.tDelegate = null;
            }

            this.@event -= handler;
        }
Esempio n. 4
0
        public void Add(ToxAv tox, EventHandler <TEventArgs> handler)
        {
            if (this.tDelegate == null)
            {
                this.tDelegate = this.create(args => this.OnCallback(tox, args));

                this.register(tox.AvHandle, this.tDelegate);
            }

            this.@event += handler;
        }
Esempio n. 5
0
        public void SetCurrent(ExtendedTox tox)
        {
            if (_toxAv != null)
            {
                _toxAv.Dispose();
            }

            _toxAv = new ToxAv(tox);

            RegisterHandlers();
        }
Esempio n. 6
0
        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = new MainWindowViewModel();
            tox = new Tox(false);
            tox.Invoker = Dispatcher.BeginInvoke;
            tox.OnNameChange += tox_OnNameChange;
            tox.OnFriendMessage += tox_OnFriendMessage;
            tox.OnFriendAction += tox_OnFriendAction;
            tox.OnFriendRequest += tox_OnFriendRequest;
            tox.OnUserStatus += tox_OnUserStatus;
            tox.OnStatusMessage += tox_OnStatusMessage;
            tox.OnTypingChange += tox_OnTypingChange;
            tox.OnConnectionStatusChanged += tox_OnConnectionStatusChanged;
            tox.OnFileSendRequest += tox_OnFileSendRequest;
            tox.OnFileData += tox_OnFileData;
            tox.OnFileControl += tox_OnFileControl;

            tox.OnGroupInvite += tox_OnGroupInvite;
            tox.OnGroupMessage += tox_OnGroupMessage;
            tox.OnGroupAction += tox_OnGroupAction;
            tox.OnGroupNamelistChange += tox_OnGroupNamelistChange;

            toxav = new ToxAv(tox.GetPointer(), ToxAv.DefaultCodecSettings, 1);
            toxav.Invoker = Dispatcher.BeginInvoke;
            toxav.OnInvite += toxav_OnInvite;
            toxav.OnStart += toxav_OnStart;
            toxav.OnStarting += toxav_OnStart;
            toxav.OnEnd += toxav_OnEnd;
            toxav.OnEnding += toxav_OnEnd;
            toxav.OnPeerTimeout += toxav_OnEnd;
            toxav.OnRequestTimeout += toxav_OnEnd;
            toxav.OnReject += toxav_OnEnd;
            toxav.OnCancel += toxav_OnEnd;
            toxav.OnReceivedAudio += toxav_OnReceivedAudio;
            toxav.OnMediaChange += toxav_OnMediaChange;

            bool bootstrap_success = false;
            foreach (ToxNode node in nodes)
            {
                if (tox.BootstrapFromNode(node))
                    bootstrap_success = true;
            }

            if (File.Exists("data"))
            {
                if (!tox.Load("data"))
                {
                    MessageBox.Show("Could not load tox data, this program will now exit.", "Error");
                    Close();
                }
            }

            tox.Start();

            if (string.IsNullOrEmpty(tox.GetSelfName()))
                tox.SetName("Toxy User");

            this.ViewModel.MainToxyUser.Name = tox.GetSelfName();
            this.ViewModel.MainToxyUser.StatusMessage = tox.GetSelfStatusMessage();

            InitializeNotifyIcon();

            SetStatus(null);
            InitFriends();

            if (tox.GetFriendlistCount() > 0)
                this.ViewModel.SelectedChatObject = this.ViewModel.ChatCollection.OfType<IFriendObject>().FirstOrDefault();
        }
Esempio n. 7
0
 private void OnCallback(ToxAv tox, TEventArgs args) => this.@event?.Invoke(tox, args);
Esempio n. 8
0
 /// <summary>
 /// Dummy. Don't use this.
 /// </summary>
 /// <param name="toxav"></param>
 public ToxCall(ToxAv toxav)
 {
     this.toxav = toxav;
 }
Esempio n. 9
0
 public ToxGroupCall(ToxAv toxav, int groupNumber)
     : base(toxav)
 {
     GroupNumber = groupNumber;
 }
Esempio n. 10
0
        private async void mv_Loaded(object sender, RoutedEventArgs e)
        {
            ToxOptions options;
            if (config.ProxyType != ToxProxyType.None)
                options = new ToxOptions(config.Ipv6Enabled, config.ProxyType, config.ProxyAddress, config.ProxyPort);
            else
                options = new ToxOptions(config.Ipv6Enabled, !config.UdpDisabled);

            tox = new Tox(options);

            var data = await loadTox();
            if (data != null)
                tox = new Tox(options, data);

            tox.OnFriendNameChanged += tox_OnFriendNameChanged;
            tox.OnFriendMessageReceived += tox_OnFriendMessageReceived;
            tox.OnFriendRequestReceived += tox_OnFriendRequestReceived;
            tox.OnFriendStatusChanged += tox_OnFriendStatusChanged;
            tox.OnFriendStatusMessageChanged += tox_OnFriendStatusMessageChanged;
            tox.OnFriendTypingChanged += tox_OnFriendTypingChanged;
            tox.OnConnectionStatusChanged += tox_OnConnectionStatusChanged;
            tox.OnFriendConnectionStatusChanged += tox_OnFriendConnectionStatusChanged;
            tox.OnFileSendRequestReceived += tox_OnFileSendRequestReceived;
            tox.OnFileChunkReceived += tox_OnFileChunkReceived;
            tox.OnFileControlReceived += tox_OnFileControlReceived;
            tox.OnFileChunkRequested += tox_OnFileChunkRequested;
            tox.OnReadReceiptReceived += tox_OnReadReceiptReceived;
            tox.OnGroupTitleChanged += tox_OnGroupTitleChanged;

            tox.OnGroupInvite += tox_OnGroupInvite;
            tox.OnGroupMessage += tox_OnGroupMessage;
            tox.OnGroupAction += tox_OnGroupAction;
            tox.OnGroupNamelistChange += tox_OnGroupNamelistChange;

            toxav = new ToxAv(tox.Handle, 1);
            toxav.OnInvite += toxav_OnInvite;
            toxav.OnStart += toxav_OnStart;
            toxav.OnEnd += toxav_OnEnd;
            toxav.OnPeerTimeout += toxav_OnEnd;
            toxav.OnRequestTimeout += toxav_OnEnd;
            toxav.OnReject += toxav_OnEnd;
            toxav.OnCancel += toxav_OnEnd;
            toxav.OnReceivedAudio += toxav_OnReceivedAudio;
            toxav.OnReceivedVideo += toxav_OnReceivedVideo;
            toxav.OnPeerCodecSettingsChanged += toxav_OnPeerCodecSettingsChanged;
            toxav.OnReceivedGroupAudio += toxav_OnReceivedGroupAudio;

            DoBootstrap();
            tox.Start();
            toxav.Start();

            if (string.IsNullOrEmpty(getSelfName()))
                tox.Name = "Tox User";

            if (string.IsNullOrEmpty(getSelfStatusMessage()))
                tox.StatusMessage = "Toxing on Toxy";

            ViewModel.MainToxyUser.Name = getSelfName();
            ViewModel.MainToxyUser.StatusMessage = getSelfStatusMessage();

            InitializeNotifyIcon();

            SetStatus(null, false);
            InitFriends();

            TextToSend.AddHandler(DragOverEvent, new DragEventHandler(Chat_DragOver), true);
            TextToSend.AddHandler(DropEvent, new DragEventHandler(Chat_Drop), true);

            ChatBox.AddHandler(DragOverEvent, new DragEventHandler(Chat_DragOver), true);
            ChatBox.AddHandler(DropEvent, new DragEventHandler(Chat_Drop), true);

            if (tox.Friends.Length > 0)
                ViewModel.SelectedChatObject = ViewModel.ChatCollection.OfType<IFriendObject>().FirstOrDefault();

            initDatabase();
            loadAvatars();
        }