本文整理汇总了C#中AsyncObservableCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# AsyncObservableCollection.Add方法的具体用法?C# AsyncObservableCollection.Add怎么用?C# AsyncObservableCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsyncObservableCollection
的用法示例。
在下文中一共展示了AsyncObservableCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslationManager
static TranslationManager()
{
AvailableLangs = new AsyncObservableCollection<TranslationLangDesc>();
try
{
_path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string[] files = Directory.GetFiles(Path.Combine(_path, "Languages"));
foreach (string file in files)
{
try
{
CultureInfo cult = CultureInfo.GetCultureInfo(Path.GetFileNameWithoutExtension(file).Replace('_','-'));
AvailableLangs.Add(new TranslationLangDesc()
{
Value = Path.GetFileNameWithoutExtension(file),
Name = cult.EnglishName + " - " + cult.NativeName
});
}
catch (Exception exception)
{
Log.Error("Error loading language", exception);
}
}
}
catch (Exception)
{
}
}
示例2: BitmapFile
public BitmapFile()
{
IsLoaded = false;
RawCodecNeeded = false;
Metadata = new AsyncObservableCollection<DictionaryItem>();
Metadata.Add(new DictionaryItem() {Name = "Exposure mode"});
Metadata.Add(new DictionaryItem() {Name = "Exposure program"});
Metadata.Add(new DictionaryItem() {Name = "Exposure time"});
Metadata.Add(new DictionaryItem() {Name = "F number"});
Metadata.Add(new DictionaryItem() {Name = "Lens focal length"});
Metadata.Add(new DictionaryItem() {Name = "ISO speed rating"});
Metadata.Add(new DictionaryItem() {Name = "Metering mode"});
Metadata.Add(new DictionaryItem() {Name = "White balance"});
Metadata.Add(new DictionaryItem() {Name = "Exposure bias"});
}
示例3: CameraPropertyWnd
public CameraPropertyWnd()
{
AvailableKeys = new AsyncObservableCollection<string>();
InitializeComponent();
foreach (string key in Enum.GetNames(typeof(Key)))
{
AvailableKeys.Add(key);
}
PhotoSessionNames = new AsyncObservableCollection<string>();
CameraPresets = new AsyncObservableCollection<string>();
}
示例4: PlayerViewModel
public PlayerViewModel()
{
HandCollection = new AsyncObservableCollection<HandViewModel>();
HandViewModel NewHand = new HandViewModel(0, 0, 1, 1);
HandCollection.Add(NewHand);
ActivePlayer = false;
PlayerPlaceHolder = @"/BlackJackSL;component/Images/Player" + PlayerId + "PlaceHolder.png";
SetPlayerPositions();
IsInPlay();
Commands.InsuranceCommand.CanExecute += (sender, e) => e.CanExecute = ActiveInsurance;
Commands.InsuranceCommand.Executed += InsuranceCommand_OnExecuted;
}
示例5: EntityViewModel
public EntityViewModel(IEntity entity)
{
this.Entity = entity;
SubEntities = new AsyncObservableCollection<EntityViewModel>();
foreach ( var e in entity.SubEntities )
{
SubEntities.Add(EVMFactory.CreateEntity(e));
}
entity.OnEntityAdded += new EventHandler<EntityEventArgs>(entity_OnEntityAdded);
entity.OnEntityRemoved += new EventHandler<EntityEventArgs>(entity_OnEntityRemoved);
}
示例6: SettingsWnd
public SettingsWnd()
{
AvailableKeys = new AsyncObservableCollection<string>();
InitializeComponent();
foreach (string key in Enum.GetNames(typeof (Key)))
{
AvailableKeys.Add(key);
}
RotateFlipTypesValues =
new AsyncObservableCollection<RotateFlipType>(
Enum.GetValues(typeof (RotateFlipType)).Cast<RotateFlipType>().Distinct());
ServiceProvider.Settings.ApplyTheme(this);
foreach (IMainWindowPlugin mainWindowPlugin in ServiceProvider.PluginManager.MainWindowPlugins)
{
cmb_mainwindow.Items.Add(mainWindowPlugin.DisplayName);
}
DataContext = ServiceProvider.Settings;
}
示例7: GetSelectedFiles
public AsyncObservableCollection<FileItem> GetSelectedFiles()
{
lock (_locker)
{
AsyncObservableCollection<FileItem> list = new AsyncObservableCollection<FileItem>();
foreach (FileItem fileItem in Files)
{
if (fileItem.IsChecked)
list.Add(fileItem);
}
return list;
}
}
示例8: SetFormatPriority
public void SetFormatPriority()
{
try
{
AsyncObservableCollection<FormatOptions> tempformatPriorityOptions = new AsyncObservableCollection<FormatOptions>();
tempformatPriorityOptions.Add(new FormatOptions(Settings.Default.priorite1080p, Settings.Default.tag1080p, Properties.Resources.label1080p));
tempformatPriorityOptions.Add(new FormatOptions(Settings.Default.priorite720p, Settings.Default.tag720p, Properties.Resources.label720p));
tempformatPriorityOptions.Add(new FormatOptions(Settings.Default.priorite480p, Settings.Default.tag480p, Properties.Resources.label480));
tempformatPriorityOptions.Add(new FormatOptions(Settings.Default.prioriteHQ360, Settings.Default.tagHQ360, Properties.Resources.labelHQ360));
tempformatPriorityOptions.Add(new FormatOptions(Settings.Default.priorite360, Settings.Default.tag360, Properties.Resources.label360));
tempformatPriorityOptions.Add(new FormatOptions(Settings.Default.priorite220, Settings.Default.tag220, Properties.Resources.label220));
formatPriorityOptions = new AsyncObservableCollection<FormatOptions>(tempformatPriorityOptions.OrderBy(otherFormat => otherFormat));
}
catch (Exception ex)
{
AddErrorMsg("DownloadManagerMV.SetFormatPriority()", ex);
}
}
示例9: GetObjects
public override AsyncObservableCollection<DeviceObject> GetObjects(object storageId, bool loadThumbs)
{
var res = new AsyncObservableCollection<DeviceObject>();
SendCommand(1283, "\\/var\\/www\\/DCIM\\/100MEDIA/");
_listingEvent.Reset();
SendCommand(1282, " -D -S");
_listingEvent.WaitOne(2500);
dynamic resp = JsonConvert.DeserializeObject(_lastData);
WebClient client = new WebClient();
foreach (JObject o in resp.listing)
{
var k = o.ToObject<Dictionary<string, string>>();
string v = k.First().Value;
var file = new DeviceObject();
file.FileName = k.First().Key;
if (file.FileName.ToLower().Contains("thm"))
continue;
file.Handle = file.FileName;
try
{
if (loadThumbs)
{
if (file.FileName.Contains(".jpg"))
file.ThumbData =
client.DownloadData(string.Format("http://{0}/DCIM/100MEDIA/{1}?type=thumb", Protocol.Ip,
file.FileName));
if (file.FileName.Contains(".mp4"))
file.ThumbData =
client.DownloadData(string.Format("http://{0}/DCIM/100MEDIA/{1}?type=thumb", Protocol.Ip,
file.FileName.Replace("mp4", "THM")));
}
if (v.Contains("|"))
file.FileDate = DateTime.ParseExact(v.Split('|')[1], "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
}
catch (Exception)
{
}
res.Add(file);
}
return res;
}
示例10: InitOverlay
private void InitOverlay()
{
Overlays = new AsyncObservableCollection<ValuePair>();
Grids = new AsyncObservableCollection<string>
{
TranslationStrings.LabelNone,
TranslationStrings.LabelRuleOfThirds,
TranslationStrings.LabelComboGrid,
TranslationStrings.LabelDiagonal,
TranslationStrings.LabelSplit
};
if (Directory.Exists(ServiceProvider.Settings.OverlayFolder))
{
string[] files = Directory.GetFiles(ServiceProvider.Settings.OverlayFolder, "*.png");
foreach (string file in files)
{
Overlays.Add(new ValuePair { Name = Path.GetFileNameWithoutExtension(file), Value = file });
}
}
OverlayTransparency = 100;
OverlayUseLastCaptured = false;
}
示例11: PopulateEQDataObject
//.........这里部分代码省略.........
}
EQ.BILLING_FX_RATE = "";
EQ.BILLING_DERIVATION_IND = "";
EQ.COLLATERAL_CURRENCY_CD = ri.LNCUR;
EQ.CALLABLE_IND = ri.CALL; //if callabledate is set, this must be set to y
EQ.SETTLEMENT_DT = ri.SSET_DT.HasValue ? ri.SSET_DT.Value.ToString("yyyyMMdd") : "";
//Required //CT=Contract, RT=Return, RC=Recall, CL=Collateral
switch (ri.COLL_FLG.ToUpper())
{
case "T": EQ.COMPARE_RECORD_TYPE_CD = "CT";
break;
case "C": EQ.COMPARE_RECORD_TYPE_CD = "CL";
break;
default: EQ.COMPARE_RECORD_TYPE_CD = EQ.COMPARE_RECORD_TYPE_CD;
break;
}
EQ.UNIT_QTY = ri.QTY.ToString();
//Required
switch (ri.OP.ToUpper())
{
case "O": EQ.ORDER_STATE_CD = "OP";
break;
case "P": EQ.ORDER_STATE_CD = "PS";
break;
default: EQ.ORDER_STATE_CD = "OP";
break;
}
EQ.ORDER_STATE_CD = ri.OP == "O" ? "OP" : "PS";
EQ.PREPAY_RATE_PCT = ri.CRATE.HasValue ? ri.CRATE.ToString() : "";
EQ.CASH_PAYMENT_AMT = ri.LNVAL.ToString();
EQ.BILLING_VALUE_AMT = ri.LNVAL.ToString();
EQ.BILLING_CURRENCY_CD = "";
EQ.COLLATERAL_DESC_CD = "";
if (ri.QTY > 0)
{
EQ.CONTRACT_PRICE_AMT = Math.Round(ri.LNVAL.Value / ri.QTY.Value, 6).ToString();
//EQ.CONTRACT_PRICE_AMT = (ri.LNVAL / ri.QTY).ToString();
}
else
{
EQ.CONTRACT_PRICE_AMT = 0.ToString();
}
EQ.COLLATERAL_MARGIN_PCT = ri.LNMRG.ToString();
EQ.CONTRACT_VALUE_AMT = ri.LNVAL.ToString();
EQ.TRADE_DT = ri.TRADE.HasValue ? ri.TRADE.Value.ToString("yyyyMMdd") : "";
EQ.COLLATERAL_DT = "";
EQ.TERM_DT = ri.TERMDT.HasValue ? ri.TERMDT.Value.ToString("yyyyMMdd") : EQ.TERM_DT;
EQ.TERM_TYPE_CD = "";
EQ.HOLD_DT = "";
EQ.CALLABLE_DT = "";
EQ.RESET_INTERVAL_DAYS = "";
EQ.REBATE_RECEIVABLE_AMT = "";
EQ.REBATE_PAYABLE_AMT = "";
EQ.FEE_RECEIVABLE_AMT = "";
EQ.FEE_PAYABLE_AMT = "";
EQ.RATE_ADJUST_DT = "";
EQ.BUYIN_DT = "";
EQ.TERMINATION_IND = "";
EQ.BORROWER_SETTLE_INSTRUC_ID = "";
EQ.LENDER_SETTLE_INSTRUC_ID = "";
EQ.SETTLEMENT_TYPE_CD = "";
EQ.MARKING_PARAMETERS = "";
//Required
EQ.INTERNAL_REF_ID = ri.BGNREF;
EQ.COUNTERPARTY_REF_ID = "";
EQ.CORPORATE_ACTION_TYPE = ""; //Corp Actions
EQ.EX_DT = ""; //Corp Actions
EQ.RECORD_DT = ""; //Corp Actions
EQ.INTERNAL_CUSTOM_FIELD = "";
EQ.EXTERNAL_CUSTOM_FIELD = "";
EQ.OLD_EQUILEND_TXN_ID = "";
EQ.BILLING_PRICE_AMT = "";
EQ.BILLING_MARGIN_PCT = "";
EQ.COLLATERAL_VALUE_AMT = ri.LNVAL.ToString();
EQ.EQUILEND_RETURN_ID = "";
EQ.RETURN_TRADE_DT = "";
EQ.RETURN_SETTLEMENT_DT = "";
EQ.EQUILEND_RECALL_ID = "";
EQ.RECALL_EFFECTIVE_DT = "";
EQ.RECALL_DUE_DT = "";
EQ.REASON_CD = "";
EQData.Add(EQ);
}
catch (Exception e)
{
throw;
}
}
}
示例12: GetSeries
/// <summary>
/// Return items with i series
/// </summary>
/// <returns>Empty list if no item was found</returns>
public AsyncObservableCollection<FileItem> GetSeries(int i)
{
lock (_locker)
{
AsyncObservableCollection<FileItem> list = new AsyncObservableCollection<FileItem>();
foreach (FileItem fileItem in Files)
{
if (fileItem.Series==i)
list.Add(fileItem);
}
return list;
}
}
示例13: loadNetworkPlugins
/// <summary>
/// Loads the network plugins.
/// </summary>
private void loadNetworkPlugins()
{
_networks = new AsyncObservableCollection<NetworkProvider>();
IEnumerable<Type> availableProtocols = CoreIntelligence.PluginIntelligence.LoadedPluginTypes.Where(x => x.IsSubclassOf(typeof(EasySocial.FrameWork.Plugins.NetworkPlugins.BaseNetworkPlugin)));
foreach (TableModels.System_Social_User2Protocol user2prot in User2Protocol.OrderBy(x => x.NetworkName))
{
foreach (Type availableProtocol in availableProtocols)
{
EasySocial.FrameWork.Plugins.BasePlugin plug = CoreIntelligence.PluginIntelligence.TryCreatingInstance(availableProtocol);
if (plug != null)
{
if (plug.Name == user2prot.NetworkName && user2prot.User == CoreIntelligence.UserIntelligence.Current.Username)
{
plug.Load();
_networks.Add(((EasySocial.FrameWork.Plugins.NetworkPlugins.BaseNetworkPlugin)plug).Network);
}
}
}
}
_networks.ToList().ForEach(x => x.Contacts.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Contacts_CollectionChanged));
}
示例14: InitOverlay
private void InitOverlay()
{
Overlays = new AsyncObservableCollection<ValuePair>();
Grids = new AsyncObservableCollection<string>();
Grids.Add(TranslationStrings.LabelNone);
Grids.Add(TranslationStrings.LabelRuleOfThirds);
Grids.Add(TranslationStrings.LabelComboGrid);
Grids.Add(TranslationStrings.LabelDiagonal);
Grids.Add(TranslationStrings.LabelSplit);
if (Directory.Exists(ServiceProvider.Settings.OverlayFolder))
{
string[] files = Directory.GetFiles(ServiceProvider.Settings.OverlayFolder, "*.png");
foreach (string file in files)
{
Overlays.Add(new ValuePair() {Name = Path.GetFileNameWithoutExtension(file), Value = file});
}
}
}
示例15: GetObjects
public override AsyncObservableCollection<DeviceObject> GetObjects(object storageId, bool loadThumbs)
{
AsyncObservableCollection<DeviceObject> res = new AsyncObservableCollection<DeviceObject>();
MTPDataResponse response = ExecuteReadDataEx(CONST_CMD_GetObjectHandles, 0xFFFFFFFF);
if (response.Data == null)
{
Log.Debug("Get object error :" + response.ErrorCode.ToString("X"));
ErrorCodes.GetException(response.ErrorCode);
return res;
}
int objCount = BitConverter.ToInt32(response.Data, 0);
for (int i = 0; i < objCount; i++)
{
DeviceObject deviceObject = new DeviceObject();
uint handle = BitConverter.ToUInt32(response.Data, 4*i + 4);
deviceObject.Handle = handle;
MTPDataResponse objectdata = ExecuteReadDataEx(CONST_CMD_GetObjectInfo, handle);
if (objectdata.Data != null)
{
uint objFormat = BitConverter.ToUInt16(objectdata.Data, 4);
if (objFormat == 0x3000 || objFormat == 0x3801 || objFormat == 0x3800)
{
deviceObject.FileName = Encoding.Unicode.GetString(objectdata.Data, 53, 12*2);
if (deviceObject.FileName.Contains("\0"))
deviceObject.FileName = deviceObject.FileName.Split('\0')[0];
try
{
string datesrt = Encoding.Unicode.GetString(objectdata.Data, 53 + (12*2) + 3, 30);
//datesrt = datesrt.Replace("T", "");
DateTime date = DateTime.MinValue;
if (DateTime.TryParseExact(datesrt, "yyyyMMddTHHmmss", CultureInfo.InvariantCulture,
DateTimeStyles.None, out date))
{
deviceObject.FileDate = date;
}
}
catch (Exception)
{
}
if (loadThumbs)
{
MTPDataResponse thumbdata = ExecuteReadDataEx(CONST_CMD_GetThumb, handle);
deviceObject.ThumbData = thumbdata.Data;
}
res.Add(deviceObject);
}
}
}
return res;
}