public void clear() { lock (typeof(TelegramSession)) { using (IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication()) { if (fileStorage.FileExists("/session.dat")) { fileStorage.DeleteFile("/session.dat"); } } instance = loadIfExists(); } }
public SignupPhone() { InitializeComponent(); session = TelegramSession.Instance; flow = new Login(session, "en"); ShowPhoneScene(); this.BackKeyPress += delegate { Application.Current.Terminate(); }; Login(); }
public void clear() { lock (typeof (TelegramSession)) { using (IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication()) { if (fileStorage.FileExists("/session.dat")) { fileStorage.DeleteFile("/session.dat"); } } instance = loadIfExists(); } }
private static TelegramSession loadIfExists() { TelegramSession session; lock(typeof(TelegramSession)) { try { using(IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication()) using(Stream fileStream = new IsolatedStorageFileStream("session.dat", FileMode.Open, fileStorage)) using(BinaryReader fileReader = new BinaryReader(fileStream)) { session = new TelegramSession(fileReader); logger.info("loaded telegram session: {0}", session); } } catch(Exception e) { logger.info("error loading session, create new...: {0}", e); logger.info("cleaning contacts"); CleanContacts(); ulong sessionId = Helpers.GenerateRandomUlong(); session = new TelegramSession(sessionId, 0); // prod 173.240.5.1 // test 173.240.5.253 TelegramEndpoint endpoint = new TelegramEndpoint("173.240.5.1", 443); TelegramDC dc = new TelegramDC(); dc.Endpoints.Add(endpoint); session.Dcs.Add(1, dc); session.SetMainDcId(1); logger.info("created new telegram session: {0}", session); } } return session; }
public Login(TelegramSession session, string langCode) { this.langCode = langCode; this.session = session; }
public DialogModelEncrypted(TelegramSession session, BinaryReader reader) : base(session) { Read(reader); }
public DialogModelEncrypted(TelegramSession session, EncryptedChat chat, byte[] key, long fingerprint, byte[] a) : base(session) { this.chat = chat; this.key = key; this.fingerprint = EncryptedChats.CalculateKeyFingerprint(key);//;fingerprint; this.a = a; }
public DialogModelEncrypted(TelegramSession session, EncryptedChat chat, byte[] a) : base(session) { logger.info("encrypted chat created with a: {0}", BitConverter.ToString(a).Replace("-", "").ToLower()); this.chat = chat; this.a = a; }
public DialogModel(TelegramSession session) { this.session = session; this.messages = new ObservableCollectionUI<MessageModel>(); }
public DialogPage() { session = TelegramSession.Instance; model = TelegramSession.Instance.Dialogs.OpenedDialog; InitializeComponent(); UpdateDataContext(); DisableEditBox(); messageEditor.GotFocus += delegate { AttachPopup.IsOpen = false; EmojiPopup.IsOpen = false; }; messageEditor.LostFocus += delegate { if (!EmojiPopup.IsOpen && !AttachPopup.IsOpen) MainPanel.Margin = new Thickness(0, 0, 0, 0); }; timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += TimerOnTick; messageEditor.TextChanged += MessageEditorOnTextChanged; EmojiPanelControl.BackspaceClick += EmojiPanelControlOnBackspaceClick; EmojiPanelControl.KeyboardClick += EmojiPanelControlOnKeyboardClick; EmojiPanelControl.EmojiGridListSelector.SelectionChanged += EmojiGridListSelectorOnSelectionChanged; }
public DialogListModel(TelegramSession session, BinaryReader reader) : this(session) { Read(reader); }
public DialogListModel(TelegramSession session) { this.session = session; }
public DialogModelPlain(Peer peer, TelegramSession session) : base(session) { this.dialog = (DialogConstructor)TL.dialog(peer, 0, 1); SubscribeToDialog(); }
public DialogModelPlain(TelegramSession session, BinaryReader reader) : base(session) { Read(reader); SubscribeToDialog(); }
public DialogModelPlain(MessageModelDelivered topMessage, TelegramSession session) : base(session) { this.dialog = (DialogConstructor) TL.dialog(topMessage.Peer, topMessage.Id, 1); this.messages.Add(topMessage); SubscribeToDialog(); }
public DialogModelPlain(Dialog dialog, TelegramSession session, Dictionary<int, MessageModel> messagesMap) : base(session) { this.dialog = (DialogConstructor) dialog; this.messages.Add(messagesMap[this.dialog.top_message]); SubscribeToDialog(); }