Exemplo n.º 1
0
        private void InitV1(object serializedSet)
        {
            ObjectsFromLocal = new List <FreeItemSelected>();

            var saved = serializedSet as IEnumerable <string>;

            if (saved != null)
            {
                try
                {
                    foreach (var item in saved)
                    {
                        if (_versionNumber == 1)
                        {
                            ObjectsFromLocal.Add(ProtoHelper.ProtoDeserializeFromString <FreeItemSelected>(item));
                        }
                        else
                        {
                            ObjectsFromLocal.Add(CommonEx.DeserializeFromString <FreeItemSelected>(item));
                        }
                    }
                }
                catch (Exception ex)
                {
                    ex.ShowMessage();
                }
            }
        }
Exemplo n.º 2
0
        private void InitV2(object serializedSet)
        {
#if DEBUG
            var sw = new System.Diagnostics.Stopwatch();
            sw.Start();
#endif

            FreeHierarchySelectedInfo selectedInfo = null;

            try
            {
                selectedInfo = ProtoHelper.ProtoDeserializeFromString <FreeHierarchySelectedInfo>(serializedSet as string);
            }
            catch (Exception ex)
            {
                ex.ShowMessage();
            }

            if (selectedInfo == null || selectedInfo.Items == null || !selectedInfo.Items.Any())
            {
                return;
            }

#if DEBUG
            sw.Stop();
            Console.WriteLine("InitV2, ProtoDeserializeFromString {0} млс", sw.ElapsedMilliseconds);
            sw.Restart();
#endif

            //Пока просто выделяем выбранные
            ObjectsFromSQL = XamTreeFinder.BuildPathFromSQL(selectedInfo
                                                            .Items
                                                            .Take(limit)
                                                            .Where(s => s.Id != null && s.IsSelect.GetValueOrDefault())
                                                            .Select(s => s.Id).ToList(), _tree.Tree_ID);

#if DEBUG
            sw.Stop();
            Console.WriteLine("InitV2, BuildPathFromSQL {0} млс", sw.ElapsedMilliseconds);
#endif
        }