private void SaveRecord() { if (this.record == null) { this.record = new AndroidFCMRecord(); } this.record.SenderId = this.senderIdTextBox.Text; this.record.AppId = this.appIdTextBox.Text; List <string> tokens = new List <string>(); foreach (var obj in this.tokenListView.Items) { TokenItem item = (TokenItem)obj; tokens.Add(item.Token); } this.record.DeviceTokens = tokens; string json = this.record.SerializeToJson(); string path = this.RecordPath; File.WriteAllText(path, json); }
private void SaveRecord() { if (this.record == null) { this.record = new IOS_APNSRecord(); } this.record.CertificateFilePath = this.certFilePathTextBox.Text; this.record.CertificatePassword = this.certPwdTextBox.Text; this.record.ServerMode = this.productionRadioButton.IsChecked ?? false; List <string> tokens = new List <string>(); foreach (var obj in this.tokenListView.Items) { TokenItem item = (TokenItem)obj; tokens.Add(item.Token); } this.record.DeviceTokens = tokens; string json = this.record.SerializeToJson(); string path = System.IO.Path.Combine(AppProperties.AppPath, RECORD_NAME); File.WriteAllText(path, json); }
private void Button_Click_1(object sender, RoutedEventArgs e) { // click add device token event DeviceTokenEditWindow win = new DeviceTokenEditWindow(); win.Callback = (string token) => { TokenItem item = new TokenItem(); item.Token = token; this.tokenListView.Items.Add(item); }; win.ShowDialog(); }
// click ListView item private void onListViewItemClick(object sender, MouseButtonEventArgs e) { if (this.tokenListView.SelectedIndex >= 0) { TokenItem item = (TokenItem)this.tokenListView.SelectedItem; DeviceTokenEditWindow win = new DeviceTokenEditWindow(item.Token); win.Callback = (string token) => { item.Token = token; this.tokenListView.Items.Refresh(); }; win.ShowDialog(); } }
public AndroidFCMWindow(AndroidSenderType type) { InitializeComponent(); this.senderType = type; switch (this.senderType) { case AndroidSenderType.FCM: this.Title = "Android FCM"; break; case AndroidSenderType.GCM: this.Title = "Android GCM"; break; } string path = this.RecordPath; if (File.Exists(path)) { // load last record try { this.record = JsonUtility.DeserializeFromJson <AndroidFCMRecord>(File.ReadAllText(path)); this.senderIdTextBox.Text = this.record.SenderId; this.appIdTextBox.Text = this.record.AppId; if (this.record.DeviceTokens != null) { foreach (string token in this.record.DeviceTokens) { TokenItem item = new TokenItem(); item.Token = token; this.tokenListView.Items.Add(item); } } } catch { } } }
public IOS_APNSWindow() { InitializeComponent(); string path = System.IO.Path.Combine(AppProperties.AppPath, RECORD_NAME); if (File.Exists(path)) { // load last record try { this.record = Xattacker.Utility.Json.JsonUtility.DeserializeFromJson <IOS_APNSRecord>(File.ReadAllText(path)); this.certFilePathTextBox.Text = this.record.CertificateFilePath; this.certPwdTextBox.Text = this.record.CertificatePassword; if (this.record.ServerMode) { this.productionRadioButton.IsChecked = true; } else { this.sandboxRadioButton.IsChecked = true; } if (this.record.DeviceTokens != null) { foreach (string token in this.record.DeviceTokens) { TokenItem item = new TokenItem(); item.Token = token; this.tokenListView.Items.Add(item); } } } catch { } } }