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)
              {

              }
        }
 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"});
 }
 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>();
 }
 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;
 }
        public AsyncObservableCollection <MemberDescriptor> DiscoverProductGroupMemberObservableDescriptors(string devManager, string testManager, string pmManager)
        {
            AsyncObservableCollection <MemberDescriptor> discriptors = new AsyncObservableCollection <MemberDescriptor>();
            Dictionary <string, MemberDescriptor>        dict        = DiscoverProductGroupMemberDescriptors(devManager, testManager, pmManager);

            foreach (KeyValuePair <string, MemberDescriptor> kvp in dict)
            {
                MemberDescriptor member = kvp.Value;
                discriptors.Add(member);
            }

            return(discriptors);
        }
Beispiel #6
0
        public static AsyncObservableCollection <T> GetItems <T>(AsyncObservableCollection <T> collection, DummyItemType collectionType, string sortPropName) where T : StoreItem, new()
        {
            AsyncObservableCollection <T> items = collection.ToCollection();

            if (collectionType == DummyItemType.NoneType || collectionType == DummyItemType.AllNoneType)
            {
                T item = StoreItem.GetDummyItem <T>(DummyItemType.NoneType);
                items.Add(item);
            }

            if (collectionType == DummyItemType.AllType || collectionType == DummyItemType.AllNoneType)
            {
                T item = StoreItem.GetDummyItem <T>(DummyItemType.AllType);
                items.Add(item);
            }

            ItemPropertySort <T> itemComparer = new ItemPropertySort <T>(sortPropName, System.ComponentModel.ListSortDirection.Ascending);

            items.Sort((x, y) => itemComparer.Compare(x, y));

            return(items);
        }
Beispiel #7
0
        public override void AddNew()
        {
            Hospital newHospital = new Hospital();

            newHospital.Name = "Enter name";


            DataStoreItemViewModel stvm = new DataStoreItemViewModel(newHospital);

            Hospitals.Add(newHospital);

            DesktopApplication.MakeModalDocument(stvm);
        }
Beispiel #8
0
        public AsyncObservableCollection <FileItem> GetSelectedFiles()
        {
            AsyncObservableCollection <FileItem> list = new AsyncObservableCollection <FileItem>();

            foreach (FileItem fileItem in Files)
            {
                if (fileItem.IsChecked)
                {
                    list.Add(fileItem);
                }
            }
            return(list);
        }
Beispiel #9
0
        private void LoadData()
        {
            if (!string.IsNullOrEmpty(AccessToken))
            {
                try
                {
                    var client = new FacebookClient
                    {
                        AccessToken = AccessToken,
                        AppId       = ClientId,
                        AppSecret   = ClientSecret
                    };
                    var result = (IDictionary <string, object>)client.Get("me");
                    UserName = (string)result["name"];
                    dynamic fbAccounts = client.Get("/me/accounts");
                    Pages = new AsyncObservableCollection <ValuePair>
                    {
                        new ValuePair()
                        {
                            Name  = "Profile page",
                            Value = (string)result["id"] + "||" + AccessToken
                        }
                    };

                    if (string.IsNullOrEmpty(SelectedPage))
                    {
                        SelectedPage = Pages[0].Value;
                    }

                    foreach (dynamic data in fbAccounts.data)
                    {
                        Pages.Add(
                            new ValuePair()
                        {
                            Name  = data.name,
                            Value = data.id + "||" + data.access_token
                        });
                    }
                    IsLogedIn = true;
                }
                catch (Exception ex)
                {
                    Log.Error("Unable to login Facebook", ex);
                    AccessToken = null;
                }
            }
            else
            {
                IsLogedIn = false;
            }
        }
Beispiel #10
0
        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);
        }
Beispiel #11
0
        public override AsyncObservableCollection <DeviceObject> GetObjects(object storageId)
        {
            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)
                        {
                        }

                        MTPDataResponse thumbdata = ExecuteReadDataEx(CONST_CMD_GetThumb, handle);
                        deviceObject.ThumbData = thumbdata.Data;
                        res.Add(deviceObject);
                    }
                }
            }
            return(res);
        }
        void DiscoverGroupMembers_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            BackgroundTask task = e.Argument as BackgroundTask;

            task.ReportProgress(0, "Creating new Product Group:", "Building the list of all the members of your new team...");
            Dictionary <string, MemberDescriptor> memberDescriptors = DiscoverProductGroupMemberDescriptors(ProductGroupToUpdate);

            DiscoveredGroupMembers = new AsyncObservableCollection <MemberDescriptor>();
            foreach (KeyValuePair <string, MemberDescriptor> kvp in memberDescriptors)
            {
                MemberDescriptor member = kvp.Value;
                DiscoveredGroupMembers.Add(member);
            }
        }
Beispiel #13
0
        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);
        }
        public void Given_SameItem_OnSourceAndDestination_DeployStatsViewerViewModel_CheckDestinationPersmisions_ShouldBeFalse()
        {
            //------------Setup for test--------------------------
            var shellViewModel = new Mock <IShellViewModel>();

            shellViewModel.Setup(model => model.ExplorerViewModel).Returns(new Mock <IExplorerViewModel>().Object);
            shellViewModel.Setup(model => model.ExplorerViewModel.ConnectControlViewModel).Returns(new Mock <IConnectControlViewModel>().Object);
            var eventAggregator = new Mock <IEventAggregator>();
            var destPermissions = new List <IWindowsGroupPermission>();

            destPermissions.Add(new WindowsGroupPermission
            {
                Administrator = true
            });
            var localhost = new Mock <IServer>();

            localhost.Setup(a => a.DisplayName).Returns("Localhost");
            localhost.SetupGet(server => server.Permissions).Returns(destPermissions);
            localhost.SetupGet(server => server.CanDeployTo).Returns(true);
            shellViewModel.Setup(x => x.LocalhostServer).Returns(localhost.Object);
            shellViewModel.Setup(x => x.ActiveServer).Returns(new Mock <IServer>().Object);
            var deployDestinationViewModel = new DeployDestinationViewModel(shellViewModel.Object, eventAggregator.Object);

            IList <IExplorerTreeItem> items = new List <IExplorerTreeItem>();
            var parentMock            = new Mock <IExplorerTreeItem>();
            var itemViewModel         = new ExplorerItemViewModel(localhost.Object, parentMock.Object, null, shellViewModel.Object, null);
            var explorerItemViewModel = new ExplorerItemNodeViewModel(localhost.Object, itemViewModel, null);
            var destinationViewModel  = new AsyncObservableCollection <IExplorerItemViewModel>();

            destinationViewModel.Add(explorerItemViewModel);
            parentMock.SetupGet(it => it.Children).Returns(destinationViewModel);
            var sourcePermissions = new List <IWindowsGroupPermission>();
            var otherServer       = new Mock <IServer>();

            otherServer.SetupGet(server => server.Permissions).Returns(sourcePermissions);
            otherServer.SetupGet(server => server.CanDeployFrom).Returns(true);
            parentMock.SetupGet(item => item.Server).Returns(otherServer.Object);
            items.Add(parentMock.Object);
            deployDestinationViewModel.Environments.First().Children = destinationViewModel;
            deployDestinationViewModel.SelectedEnvironment = deployDestinationViewModel.Environments.First();

            var stat = new DeployStatsViewerViewModel(items, deployDestinationViewModel);

            Assert.IsTrue(deployDestinationViewModel.SelectedEnvironment.AsList().Count > 0);
            //------------Execute Test---------------------------
            Assert.IsNotNull(stat);
            stat.Calculate(items);
            //------------Assert Results-------------------------
            Assert.IsFalse(items.First().CanDeploy);
        }
        public AsyncObservableCollection <IDataStoreItem> GetItems(Type type, ICollection <RetrievalCriteria> criteria)
        {
            logger.Trace("GetItems( " + type.Name + ", criteria...");
            AsyncObservableCollection <IDataStoreItem> result = new AsyncObservableCollection <IDataStoreItem>();
            List <IDataStoreItem> items = retriever.RetrieveItems(type, criteria);

            logger.Trace("Results includes " + items.Count + " elements");
            foreach (IDataStoreItem i in items)
            {
                logger.Trace("Added item to result");
                result.Add(i);
            }
            return(result);
        }
Beispiel #16
0
        private void InitializeElevationFilters()
        {
            AltitudeTimesFrom      = new AsyncObservableCollection <DateTime>();
            AltitudeTimesThrough   = new AsyncObservableCollection <DateTime>();
            MinimumAltitudeDegrees = new AsyncObservableCollection <KeyValuePair <double, string> >();

            var d = GetReferenceDate(SelectedDate);

            AltitudeTimesFrom.Add(DateTime.MinValue);
            AltitudeTimesThrough.Add(DateTime.MaxValue);

            for (int i = 0; i <= 24; i++)
            {
                AltitudeTimesFrom.Add(d);
                AltitudeTimesThrough.Add(d);
                d = d.AddHours(1);
            }

            for (int i = 0; i <= 90; i += 10)
            {
                MinimumAltitudeDegrees.Add(new KeyValuePair <double, string>(i, i + "°"));
            }
        }
Beispiel #17
0
 public ZoneMapViewModel()
 {
     MapCenter = MapCenterUser = new Location(55.75, 37.62);
     _zoneHandler.LoadCompleted += zoneHandler_LoadCompleted;
     _zoneHandler.Update();
     if (Zones.Count != 0)
     {
         return;
     }
     if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
     {
         ObservableCollection <Location> Points = new AsyncObservableCollection <Location>();
         Points.Add(new Location(55.758, 37.76));
         Points.Add(new Location(55.75, 37.5));
         Points.Add(new Location(55.8, 37.625));
         var z = new VmPolyline(Zones.Count);
         z.PropertyChanged += Zone_PropertyChanged;
         Zones.Add(z);
         Zones[0].AddLocation(Points[0], false);
         Zones[0].AddLocation(Points[1], false);
         Zones[0].AddLocation(Points[2], false);
     }
 }
Beispiel #18
0
 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"
     });
 }
 /// <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 && fileItem.Visible)
             {
                 list.Add(fileItem);
             }
         }
         return(list);
     }
 }
Beispiel #20
0
 private void GetChatrooms(RoomList chatrooms)
 {
     joinableRooms = new AsyncObservableCollection <Room>();
     foreach (string room in chatrooms.chatrooms)
     {
         string roomName = room.Remove(0, 10);
         Room   newRoom  = new Room {
             name = roomName
         };
         if (!rooms.Contains(newRoom))
         {
             joinableRooms.Add(newRoom);
         }
     }
 }
 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());
     foreach (IMainWindowPlugin mainWindowPlugin in ServiceProvider.PluginManager.MainWindowPlugins)
     {
         cmb_mainwindow.Items.Add(mainWindowPlugin.DisplayName);
     }
     DataContext = ServiceProvider.Settings;
 }
Beispiel #22
0
        public bool Clone(ProfileMeta profileInfo)
        {
            lock (lockobj) {
                using (MyStopWatch.Measure()) {
                    if (profileFileWatcher != null)
                    {
                        profileFileWatcher.EnableRaisingEvents = false;
                    }

                    IProfile clone = null;
                    if (profileInfo.Id == ActiveProfile.Id)
                    {
                        clone = Profile.Clone(ActiveProfile);
                    }
                    else
                    {
                        try {
                            var p = Profile.Load(profileInfo.Location);
                            clone = Profile.Clone(p);
                            p.Dispose();
                        } catch (Exception) {
                            //Profile is in use
                            return(false);
                        }
                    }

                    if (clone != null)
                    {
                        clone.Save();

                        var info = new ProfileMeta()
                        {
                            Id = clone.Id, Name = clone.Name, Location = clone.Location
                        };
                        Profiles.Add(info);
                        clone.Dispose();

                        if (profileFileWatcher != null)
                        {
                            profileFileWatcher.EnableRaisingEvents = true;
                        }
                    }
                    return(true);
                }
            }
        }
Beispiel #23
0
        private AsyncObservableCollection <Type0_Keyframe> ParseKeyframes(int keyframeCount, int keyframeListOffset, int floatOffset)
        {
            AsyncObservableCollection <Type0_Keyframe> keyframes = AsyncObservableCollection <Type0_Keyframe> .Create();

            for (int i = 0; i < keyframeCount; i++)
            {
                keyframes.Add(new Type0_Keyframe()
                {
                    Index = BitConverter.ToUInt16(rawBytes, keyframeListOffset),
                    Float = BitConverter.ToSingle(rawBytes, floatOffset)
                });
                keyframeListOffset += 2;
                floatOffset        += 4;
            }

            return(keyframes);
        }
 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;
 }
        public void Given_TheSameServer_CheckDestinationPersmisions_ShouldBeTrue()
        {
            //------------Setup for test--------------------------
            var shellViewModel = new Mock <IShellViewModel>();

            shellViewModel.Setup(model => model.ExplorerViewModel).Returns(new Mock <IExplorerViewModel>().Object);
            shellViewModel.Setup(model => model.ExplorerViewModel.ConnectControlViewModel).Returns(new Mock <IConnectControlViewModel>().Object);
            var eventAggregator = new Mock <IEventAggregator>();

            var localhost = new Mock <IServer>();

            localhost.Setup(a => a.DisplayName).Returns("Localhost");
            localhost.SetupGet(server => server.CanDeployTo).Returns(true);
            localhost.SetupGet(server => server.CanDeployFrom).Returns(true);

            shellViewModel.Setup(x => x.LocalhostServer).Returns(localhost.Object);

            var deployDestinationViewModel = new DeployDestinationViewModel(shellViewModel.Object, eventAggregator.Object);

            var sourceItemViewModel = new ExplorerItemViewModel(localhost.Object, null, null, shellViewModel.Object, null);

            var sourceViewModel             = new AsyncObservableCollection <IExplorerItemViewModel>();
            var sourceExplorerItemViewModel = new ExplorerItemNodeViewModel(localhost.Object, sourceItemViewModel, null);

            sourceViewModel.Add(sourceExplorerItemViewModel);

            var destinationViewModel = SetDestinationExplorerItemViewModels(Guid.Empty, localhost, shellViewModel, localhost);

            IList <IExplorerTreeItem> sourceExplorerItem = new List <IExplorerTreeItem>();

            sourceExplorerItem.Add(sourceExplorerItemViewModel);

            deployDestinationViewModel.Environments.First().Children = destinationViewModel;
            deployDestinationViewModel.SelectedEnvironment = deployDestinationViewModel.Environments.First();

            var stat = new DeployStatsViewerViewModel(sourceExplorerItem, deployDestinationViewModel);

            Assert.IsTrue(deployDestinationViewModel.SelectedEnvironment.AsList().Count > 0);
            //------------Execute Test---------------------------
            Assert.IsNotNull(stat);
            stat.Calculate(sourceExplorerItem);
            //------------Assert Results-------------------------
            Assert.IsTrue(sourceExplorerItem.First().CanDeploy);
        }
Beispiel #26
0
        private void LoadAlbums()
        {
            try
            {
                String url    = string.Format("/{0}/albums", SelectedPage.Split(new [] { "||" }, StringSplitOptions.RemoveEmptyEntries)[0]);
                string token  = SelectedPage.Split(new[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[1];
                var    client = new FacebookClient
                {
                    AccessToken = AccessToken,
                    AppId       = ClientId,
                    AppSecret   = ClientSecret
                };
                Albums = new AsyncObservableCollection <ValuePair>();
                do
                {
                    dynamic albums = client.Get(url, new { limit = 25, offset = 0 });

                    foreach (dynamic data in albums.data)
                    {
                        Albums.Add(new ValuePair()
                        {
                            Value = data.id + "||" + token, Name = data.name
                        });
                    }

                    if (albums.paging != null && !String.IsNullOrEmpty(albums.paging.next))
                    {
                        url = albums.paging.next;
                    }
                    else
                    {
                        url = String.Empty;
                    }
                } while (!String.IsNullOrEmpty(url));
                if (string.IsNullOrEmpty(SelectedAlbum) && Albums.Any())
                {
                    SelectedAlbum = Albums[0].Value;
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #27
0
        public void InitializeIBsaTypes()
        {
            InitBsaLists();

            IBsaTypes = AsyncObservableCollection <IBsaType> .Create();

            foreach (var bsaEntry in Type0)
            {
                IBsaTypes.Add(bsaEntry);
            }
            foreach (var bsaEntry in Type1)
            {
                IBsaTypes.Add(bsaEntry);
            }
            foreach (var bsaEntry in Type2)
            {
                IBsaTypes.Add(bsaEntry);
            }
            foreach (var bsaEntry in Type3)
            {
                IBsaTypes.Add(bsaEntry);
            }
            foreach (var bsaEntry in Type4)
            {
                IBsaTypes.Add(bsaEntry);
            }
            foreach (var bsaEntry in Type6)
            {
                IBsaTypes.Add(bsaEntry);
            }
            foreach (var bsaEntry in Type7)
            {
                IBsaTypes.Add(bsaEntry);
            }
            foreach (var bsaEntry in Type8)
            {
                IBsaTypes.Add(bsaEntry);
            }
        }
Beispiel #28
0
        private void StartAccount(Account account)
        {
            var service = _serviceResolver.Resolve(account.ProtocolType);

            if (service == null)
            {
                return;
            }

            _servicesPool.Add(account.Id, service);
            service.Init(account);

            if (_emailGroupList.All(m => m.AccountId != account.Id))
            {
                _emailGroupList.Add(service.EmailGroup);
            }

            _mailStorage.AddLoadedEmails(service.EmailGroup);
            service.Start();
        }
Beispiel #29
0
        private void OnItemSourceChanged(IList enumerable)
        {
            Selectables = new AsyncObservableCollection <SelectableItem <object> >(enumerable.Count);
            foreach (var item in enumerable)
            {
                if (displatProperty == null)
                {
                    displatProperty = item.GetType().GetProperty(DisplayMemberPath);
                }

                if (displatProperty != null)
                {
                    var selectable = SelectableItem <object> .Create(item);

                    selectable.Title          = GetTitle(item);
                    selectable.SelectChanged += SelectableSelectChanged;
                    Selectables.Add(selectable);
                }
            }
        }
Beispiel #30
0
        private AsyncObservableCollection <EAN_Keyframe> ParseKeyframes(int indexOffset, int floatOffset, int count, int indexSize, int floatSize)
        {
            AsyncObservableCollection <EAN_Keyframe> keyframes = AsyncObservableCollection <EAN_Keyframe> .Create();

            for (int i = 0; i < count; i++)
            {
                keyframes.Add(new EAN_Keyframe());

                //Index
                if (indexSize == 0)
                {
                    keyframes[i].FrameIndex = rawBytes[indexOffset];
                    indexOffset            += 1;
                }
                else if (indexSize == 1)
                {
                    keyframes[i].FrameIndex = BitConverter.ToUInt16(rawBytes, indexOffset);
                    indexOffset            += 2;
                }

                //Floats
                if (floatSize == 1)
                {
                    keyframes[i].X = Half.ToHalf(rawBytes, floatOffset + 0);
                    keyframes[i].Y = Half.ToHalf(rawBytes, floatOffset + 2);
                    keyframes[i].Z = Half.ToHalf(rawBytes, floatOffset + 4);
                    keyframes[i].W = Half.ToHalf(rawBytes, floatOffset + 6);
                    floatOffset   += 8;
                }
                else if (floatSize == 2)
                {
                    keyframes[i].X = BitConverter.ToSingle(rawBytes, floatOffset + 0);
                    keyframes[i].Y = BitConverter.ToSingle(rawBytes, floatOffset + 4);
                    keyframes[i].Z = BitConverter.ToSingle(rawBytes, floatOffset + 8);
                    keyframes[i].W = BitConverter.ToSingle(rawBytes, floatOffset + 12);
                    floatOffset   += 16;
                }
            }

            return(keyframes);
        }
Beispiel #31
0
        private void InitializeSizeFilters()
        {
            SizesFrom    = new AsyncObservableCollection <KeyValuePair <string, string> >();
            SizesThrough = new AsyncObservableCollection <KeyValuePair <string, string> >();

            SizesFrom.Add(new KeyValuePair <string, string>(string.Empty, string.Empty));
            SizesThrough.Add(new KeyValuePair <string, string>(string.Empty, string.Empty));

            SizesFrom.Add(new KeyValuePair <string, string>("1", "1 " + Locale.Loc.Instance["LblArcsec"]));
            SizesFrom.Add(new KeyValuePair <string, string>("5", "5 " + Locale.Loc.Instance["LblArcsec"]));
            SizesFrom.Add(new KeyValuePair <string, string>("10", "10 " + Locale.Loc.Instance["LblArcsec"]));
            SizesFrom.Add(new KeyValuePair <string, string>("30", "30 " + Locale.Loc.Instance["LblArcsec"]));
            SizesFrom.Add(new KeyValuePair <string, string>("60", "1 " + Locale.Loc.Instance["LblArcmin"]));
            SizesFrom.Add(new KeyValuePair <string, string>("300", "5 " + Locale.Loc.Instance["LblArcmin"]));
            SizesFrom.Add(new KeyValuePair <string, string>("600", "10 " + Locale.Loc.Instance["LblArcmin"]));
            SizesFrom.Add(new KeyValuePair <string, string>("1800", "30 " + Locale.Loc.Instance["LblArcmin"]));
            SizesFrom.Add(new KeyValuePair <string, string>("3600", "1 " + Locale.Loc.Instance["LblDegree"]));
            SizesFrom.Add(new KeyValuePair <string, string>("18000", "5 " + Locale.Loc.Instance["LblDegree"]));
            SizesFrom.Add(new KeyValuePair <string, string>("36000", "10 " + Locale.Loc.Instance["LblDegree"]));

            SizesThrough = new AsyncObservableCollection <KeyValuePair <string, string> >(SizesFrom);
        }
Beispiel #32
0
        public async void GetGitHubReleases(AsyncObservableCollection <Release> releaseList)
        {
            try
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    GitHubClient githubClient = new GitHubClient(new ProductHeaderValue("Vulnerator"));
                    var          releases     = await githubClient.Repository.Release.GetAll("Vulnerator", "Vulnerator");

                    for (int i = 0; i < releases.Count; i++)
                    {
                        Release release = new Release();
                        release.Name = releases[i].Name;
                        if (releases[i].TagName != null)
                        {
                            release.TagName = releases[i].TagName;
                        }
                        else
                        {
                            release.TagName = "No Tag Name Assigned";
                        }
                        release.HtmlUrl   = releases[i].HtmlUrl;
                        release.Body      = releases[i].Body;
                        release.CreatedAt = releases[i].CreatedAt.Date.ToLongDateString();
                        release.Downloads = releases[i].Assets[0].DownloadCount;
                        releaseList.Add(release);
                    }
                }
                else
                {
                    LogWriter.LogWarning("GitHub releases are only available if an internet connection is available.");
                }
            }
            catch (Exception exception)
            {
                string error = "Unable to retrieve GitHub Vulnerator release listing.";
                LogWriter.LogErrorWithDebug(error, exception);
            }
        }
Beispiel #33
0
        private AsyncObservableCollection <Parameter> ParseParameters(int offset, int count)
        {
            if (count > 0)
            {
                AsyncObservableCollection <Parameter> paramaters = AsyncObservableCollection <Parameter> .Create();

                for (int i = 0; i < count; i++)
                {
                    paramaters.Add(new Parameter()
                    {
                        Str_00 = Utils.GetString(bytes, offset + 0, 32),
                        I_32   = GetValueType(BitConverter.ToInt32(rawBytes, offset + 32), offset + 36),
                        value  = GetValue(BitConverter.ToInt32(rawBytes, offset + 32), offset + 36)
                    });
                    offset += 40;
                }

                return(paramaters);
            }
            else
            {
                return(AsyncObservableCollection <Parameter> .Create());
            }
        }
        /// <summary>
        /// Loads the contacts from the Database.
        /// </summary>
        private void loadContacts()
        {
            while (clistLocked) ;
            clistLocked = true;
            _contactContainers = new AsyncObservableCollection<ContactContainer>();
            foreach (NetworkProvider provider in Networks)
            {
                generateMissingContainers(provider);
            }
            clistLocked = false;

            if (CoreIntelligence.RepositoryIntelligence.Initialized)
            {
                IEnumerable<ContactContainer> temp = ContactContainer.Select(x => new ContactContainer(x, CoreIntelligence)).Select(x => x);
                temp.ToList().ForEach(x => _contactContainers.Add(x));
            }
        }
Beispiel #35
0
        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;
        }
Beispiel #36
0
        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;
        }
        private void PopulateEQDataObject(List <ve_g1position_gqlObject> raw, AsyncObservableCollection <EquilendExcelDataObjectGrid> EQData, string LegalEntity)
        {
            foreach (var ri in raw)
            {
                try
                {
                    EquilendExcelDataObjectGrid EQ = new EquilendExcelDataObjectGrid();

                    //Just for grid
                    EQ.Cpty             = ri.CPTY;
                    EQ.Name             = ri.NAME;
                    EQ.CtpyAgentAccount = ri.CtpyAgentAccount;
                    EQ.TIMETABLE_ID     = ri.TimeTableID.ToString();

                    EQ.EQUILEND_TXN_ID = "";

                    //Required
                    EQ.LEGAL_ENTITY_ID      = LegalEntity;
                    EQ.CPTY_LEGAL_ENTITY_ID = ri.LoanNet_Counterparty_Id;   //Stored proc changes this to equilend id
                    EQ.BORROW_LOAN_TYPE_CD  = ri.BL;

                    EQ.SUBACCOUNT_ID = "";

                    //Required
                    EQ.SECURITY_ID         = string.IsNullOrEmpty(ri.CUSIP) ? ri.SEDOL : ri.CUSIP;
                    EQ.SECURITY_ID_TYPE_CD = string.IsNullOrEmpty(ri.CUSIP) ? "S" : "C";    //I,S,C,Q,V

                    EQ.RATE_TYPE_CD = "";
                    EQ.RATE_AMT     = (ri.CASH != null && ri.CASH.ToLower() == "c") ? ri.LNRATE.Value.ToString() : EQ.RATE_AMT;
                    EQ.FEE_TYPE_CD  = "";

                    //EQ.FEE_AMT = (ri.CASH != null && ri.CASH.ToLower() == "n" && ri.COLL_FLG != null && ri.COLL_FLG.ToLower() == "t") ? ri.LNRATE.Value.ToString() : EQ.FEE_AMT;

                    if (ri.CASH != null && ri.CASH.ToLower() == "n")
                    {
                        EQ.FEE_AMT = ri.LNRATE.Value.ToString();
                    }
                    else
                    {
                        EQ.FEE_AMT = EQ.FEE_AMT;
                    }

                    //if cash n and coll flg c then

                    EQ.DIVIDEND_RATE_PCT     = ri.DIV_AGE.ToString();
                    EQ.DIVIDEND_TRACKING_IND = ri.LNT_DIV_TRACKING;


                    switch (ri.CASH.ToUpper())
                    {
                    case "C": EQ.COLLATERAL_TYPE_CD = "CA";
                        break;

                    case "N": EQ.COLLATERAL_TYPE_CD = "NC";
                        break;

                    case "T": EQ.COLLATERAL_TYPE_CD = "CP";
                        break;

                    default: EQ.COLLATERAL_TYPE_CD = "CA";
                        break;
                    }

                    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;
                }
            }
        }
        /// <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));
        }
Beispiel #39
0
        public PackageViewModel(IPackage entity)
            : base(entity)
        {
            CategorizedEntities = new AsyncObservableCollection<KeyValuePair<string, AsyncObservableCollection<EntityViewModel>>>();
             // Initialize the Categories

             foreach ( var cat in EntitySchema.Categories )
             {
            CategorizedEntities.Add(new KeyValuePair<string, AsyncObservableCollection<EntityViewModel>>(cat,
               new AsyncObservableCollection<EntityViewModel>()));
             }

             foreach ( var item in SubEntities )
             {
            string category = item.Entity.Schema.Category;
            GetEntityListForCatagory(category).Add(item);
             }

             BuildOutput = new AsyncObservableCollection<string>();

             RegisterEventHandlers();
        }
        private void LoadAlbums()
        {
            try
            {
                String url = string.Format("/{0}/albums", SelectedPage.Split(new []{"||"},StringSplitOptions.RemoveEmptyEntries)[0]);
                string token = SelectedPage.Split(new[] {"||"}, StringSplitOptions.RemoveEmptyEntries)[1];
                var client = new FacebookClient
                {
                    AccessToken = AccessToken,
                    AppId = ClientId,
                    AppSecret = ClientSecret
                };
                Albums = new AsyncObservableCollection<ValuePair>();
                do
                {
                    dynamic albums = client.Get(url, new { limit = 25, offset = 0 });

                    foreach (dynamic data in albums.data)
                    {
                        Albums.Add(new ValuePair() { Value = data.id+"||"+token, Name = data.name });
                    }

                    if (albums.paging != null && !String.IsNullOrEmpty(albums.paging.next))
                        url = albums.paging.next;
                    else
                        url = String.Empty;
                } while (!String.IsNullOrEmpty(url));
                if (string.IsNullOrEmpty(SelectedAlbum) && Albums.Any())
                {
                    SelectedAlbum = Albums[0].Value;
                }
            }
            catch (Exception)
            {

            }
        }
        private void LoadData()
        {
            if (!string.IsNullOrEmpty(AccessToken))
            {
                try
                {
                    var client = new FacebookClient
                    {
                        AccessToken = AccessToken,
                        AppId = ClientId,
                        AppSecret = ClientSecret
                    };
                    var result = (IDictionary<string, object>) client.Get("me");
                    UserName = (string) result["name"];
                    dynamic fbAccounts = client.Get("/me/accounts");
                    Pages = new AsyncObservableCollection<ValuePair>
                    {
                        new ValuePair()
                        {
                            Name = "Profile page",
                            Value = (string) result["id"]+"||"+AccessToken
                        }
                    };

                    if (string.IsNullOrEmpty(SelectedPage))
                        SelectedPage = Pages[0].Value;

                    foreach (dynamic data in fbAccounts.data)
                    {
                        Pages.Add(
                            new ValuePair()
                            {
                                Name = data.name,
                                Value = data.id + "||" + data.access_token
                            });
                    }
                    IsLogedIn = true;

                }
                catch (Exception ex)
                {
                    Log.Error("Unable to login Facebook", ex);
                    AccessToken = null;
                }
            }
            else
            {
                IsLogedIn = false;
            }
        }
 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});
         }
     }
 }
 private void InitVariableList()
 {
     _variableList = new AsyncObservableCollection<string>();
     _variableList.Add("camera");
     var processor = new CommandLineProcessor();
     var resp = processor.Pharse(new[] { "list", "camera" });
     var list = resp as IEnumerable<string>;
     if (list != null)
     {
         foreach (string s in list)
         {
             _variableList.Add(s.Split('=')[0]);
         }
     }
     resp = processor.Pharse(new[] { "list", "property" });
     list = resp as IEnumerable<string>;
     if (list != null)
     {
         foreach (string s in list)
         {
             _variableList.Add(s.Split('=')[0]);
         }
     }
     resp = processor.Pharse(new[] { "list", "session" });
     list = resp as IEnumerable<string>;
     if (list != null)
     {
         foreach (string s in list)
         {
             _variableList.Add(s.Split('=')[0]);
         }
     }
 }
        private void Refresh()
        {
            try
            {
                Dictionary<string, int> dictionary = new Dictionary<string, int>();

                Formats = new AsyncObservableCollection<NamedValue<int>>();

                if (!IsInDesignMode)
                {
                    Apps = new ObservableCollection<DbEvents>(ServiceProvider.Database.GetApp(From, To));
                    Files = new ObservableCollection<DbFile>(ServiceProvider.Database.GetFiles(From, To));

                    dictionary.Add("Jpg",0);
                    dictionary.Add("Raw", 0);
                    dictionary.Add("Video", 0);
                    dictionary.Add("Other", 0);

                    foreach (var file in Files)
                    {
                        var item=new FileItem(file.File);
                        if (item.IsJpg)
                            dictionary["Jpg"]++;
                        else if (item.IsRaw)
                        {
                            dictionary["Raw"]++;
                        }
                        else if (item.IsMovie)
                        {
                            dictionary["Video"]++;
                        }
                        else
                        {
                            dictionary["Other"]++;
                        }
                    }
                    foreach (var i in dictionary)
                    {
                        if(i.Value>0)
                        Formats.Add(new NamedValue<int>(i.Key,i.Value));
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("", ex);
            }
        }
 private void Refresh()
 {
     Cameras=new AsyncObservableCollection<NamedValue<int>>();
     Cameras.Add(new NamedValue<int>("Raw", 10));
     Cameras.Add(new NamedValue<int>("Jpg", 90));
 }
Beispiel #46
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (_photoSession.Braketing.ExposureValues.Count == 0)
            {
                _photoSession.Braketing.ExposureValues = new AsyncObservableCollection <string> {
                    "-1", "0", "+1"
                }
            }
            ;
            foreach (string value in _device.ExposureCompensation.Values)
            {
                CheckedListItem item = new CheckedListItem()
                {
                    Name      = value,
                    IsChecked = _photoSession.Braketing.ExposureValues.Contains(value)
                };
                item.PropertyChanged += item_PropertyChanged;
                collection.Add(item);
            }
            listBox1.ItemsSource = collection;

            Dictionary <long, string> exposurevals = new Dictionary <long, string>();

            int s_index = _device.ShutterSpeed.Values.IndexOf(_device.ShutterSpeed.Value);
            int s_min   = s_index - 4;
            int s_max   = s_index + 4;

            //exposurevals.Add(s_index, "0");
            //long incre = _device.ShutterSpeed.NumericValues[s_index];
            //int step = 0;
            //for (int i = s_index; i < _device.ShutterSpeed.Values.Count; i++)
            //{
            //  if (_device.ShutterSpeed.NumericValues[i]%incre == 0)
            //  {
            //    exposurevals.Add(i, step.ToString());
            //    step++;
            //    incre = _device.ShutterSpeed.NumericValues[i];
            //  }
            //}

            //incre = _device.ShutterSpeed.NumericValues[s_index];
            //step = 0;

            //for (int i = s_index; i >0; i--)
            //{
            //  if (incre % _device.ShutterSpeed.NumericValues[i] == 0)
            //  {
            //    if (step != 0)
            //    {
            //      exposurevals.Add(i, (-step).ToString());
            //    }
            //    step++;
            //    incre = _device.ShutterSpeed.NumericValues[i];
            //  }
            //}

            if (s_min < 0)
            {
                s_min = 0;
            }
            if (s_max >= _device.ShutterSpeed.Values.Count)
            {
                s_max = _device.ShutterSpeed.Values.Count - 1;
            }
            for (int i = 0; i < _device.ShutterSpeed.Values.Count; i++)
            {
                if (_device.ShutterSpeed.Values[i] == "Bulb")
                {
                    continue;
                }
                CheckedListItem item = new CheckedListItem()
                {
                    Name =
                        _device.ShutterSpeed.Values[i] +
                        (exposurevals.ContainsKey(i) ? " EV " + exposurevals[i] : ""),
                    Tag = _device.ShutterSpeed.Values[i]
                };
                if (i == s_index || i == s_min || i == s_max)
                {
                    item.IsChecked = true;
                }
                item.PropertyChanged += item_PropertyChanged;
                shuttercollection.Add(item);
            }
            lst_shutter.ItemsSource = shuttercollection;

            foreach (CameraPreset cameraPreset in ServiceProvider.Settings.CameraPresets)
            {
                CheckedListItem item = new CheckedListItem()
                {
                    Name      = cameraPreset.Name,
                    IsChecked =
                        _photoSession.Braketing.PresetValues.Contains(cameraPreset.Name)
                };
                item.PropertyChanged += item_PropertyChanged;
                presetcollection.Add(item);
            }
            lst_preset.ItemsSource = presetcollection;

            foreach (string value in _device.FNumber.Values)
            {
                CheckedListItem item = new CheckedListItem()
                {
                    Name      = value,
                    IsChecked =
                        _photoSession.Braketing.ApertureValues.Contains(value)
                };
                item.PropertyChanged += item_PropertyChanged;
                aperturecollection.Add(item);
            }
            lst_aperture.ItemsSource = aperturecollection;

            if (_device.Mode.Value == "M")
            {
                tab_exposure.Visibility      = Visibility.Visible;
                tab_manual.Visibility        = Visibility.Visible;
                tab_manual.IsSelected        = true;
                _photoSession.Braketing.Mode = 1;
            }
            else
            {
                _photoSession.Braketing.Mode = 0;
                tab_exposure.Visibility      = Visibility.Visible;
                tab_manual.Visibility        = Visibility.Collapsed;
                tab_exposure.IsSelected      = true;
            }

            if (_device.Mode.Value == "M" || _device.Mode.Value == "A")
            {
                tab_aperture.Visibility = Visibility.Visible;
            }
            else
            {
                tab_aperture.Visibility = Visibility.Collapsed;
            }

            item_PropertyChanged(null, null);
        }
 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;
 }
        private void Refresh()
        {
            try
            {
                Dictionary<string, int> dictionary = new Dictionary<string, int>();

                Formats = new AsyncObservableCollection<NamedValue<int>>();
                Cameras = new AsyncObservableCollection<NamedValue<int>>();
                Sessions = new AsyncObservableCollection<NamedValue<int>>();
                Summary = new AsyncObservableCollection<NamedValue<string>>();

                if (!IsInDesignMode)
                {
                    Apps = new ObservableCollection<DbEvents>(ServiceProvider.Database.GetApp(From, To));
                    Files = new ObservableCollection<DbFile>(ServiceProvider.Database.GetFiles(From, To));

                    dictionary.Add("Jpg",0);
                    dictionary.Add("Raw", 0);
                    dictionary.Add("Video", 0);
                    dictionary.Add("Other", 0);

                    foreach (var file in Files)
                    {
                        var item=new FileItem(file.File);
                        if (item.IsJpg)
                            dictionary["Jpg"]++;
                        else if (item.IsRaw)
                        {
                            dictionary["Raw"]++;
                        }
                        else if (item.IsMovie)
                        {
                            dictionary["Video"]++;
                        }
                        else
                        {
                            dictionary["Other"]++;
                        }
                    }
                    foreach (var i in dictionary)
                    {
                        if(i.Value>0)
                        Formats.Add(new NamedValue<int>(i.Key,i.Value));
                    }

                    dictionary.Clear();
                    foreach (DbFile file in Files)
                    {
                        if(!dictionary.ContainsKey(file.Camera))
                            dictionary.Add(file.Camera,0);
                        dictionary[file.Camera]++;
                    }

                    foreach (var i in dictionary)
                    {
                            Cameras.Add(new NamedValue<int>(i.Key, i.Value));
                    }

                    dictionary.Clear();
                    foreach (DbFile file in Files)
                    {
                        if (!dictionary.ContainsKey(file.Session))
                            dictionary.Add(file.Session, 0);
                        dictionary[file.Session]++;
                    }

                    foreach (var i in dictionary)
                    {
                        Sessions.Add(new NamedValue<int>(i.Key, i.Value));
                    }

                    Summary.Add(new NamedValue<string>("Total photos", Files.Count.ToString()));
                    Summary.Add(new NamedValue<string>("Total used session", Sessions.Count.ToString()));
                    Summary.Add(new NamedValue<string>("Total used cameras", Cameras.Count.ToString()));

                    if (Files.Count > 0)
                    {
                        Summary.Add(new NamedValue<string>("Most used apperture",
                            Files.GroupBy(x => x.F).OrderByDescending(x => x.Count()).First().Key));
                        Summary.Add(new NamedValue<string>("Most used exposure",
                            Files.GroupBy(x => x.E).OrderByDescending(x => x.Count()).First().Key));
                        Summary.Add(new NamedValue<string>("Most used ISO",
                            Files.GroupBy(x => x.Iso).OrderByDescending(x => x.Count()).First().Key));
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("", ex);
            }
        }
 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;
     }
 }
Beispiel #50
0
        private void PopulateEQDataObject(List<ve_g1position_gqlObject> raw, AsyncObservableCollection<EquilendExcelDataObjectGrid> EQData, string LegalEntity)
        {
            foreach (var ri in raw)
            {
                try
                {
                    EquilendExcelDataObjectGrid EQ = new EquilendExcelDataObjectGrid();

                    //Just for grid
                    EQ.Cpty = ri.CPTY;
                    EQ.Name = ri.NAME;
                    EQ.CtpyAgentAccount = ri.CtpyAgentAccount;
                    EQ.TIMETABLE_ID = ri.TimeTableID.ToString();

                    EQ.EQUILEND_TXN_ID = "";

                    //Required
                    EQ.LEGAL_ENTITY_ID = LegalEntity;
                    EQ.CPTY_LEGAL_ENTITY_ID = ri.LoanNet_Counterparty_Id;   //Stored proc changes this to equilend id
                    EQ.BORROW_LOAN_TYPE_CD = ri.BL;

                    EQ.SUBACCOUNT_ID = "";

                    //Required
                    EQ.SECURITY_ID = string.IsNullOrEmpty(ri.CUSIP) ? ri.SEDOL : ri.CUSIP;
                    EQ.SECURITY_ID_TYPE_CD = string.IsNullOrEmpty(ri.CUSIP) ? "S" : "C";    //I,S,C,Q,V

                    EQ.RATE_TYPE_CD = "";
                    EQ.RATE_AMT = (ri.CASH != null && ri.CASH.ToLower() == "c") ? ri.LNRATE.Value.ToString() : EQ.RATE_AMT;
                    EQ.FEE_TYPE_CD = "";

                    //EQ.FEE_AMT = (ri.CASH != null && ri.CASH.ToLower() == "n" && ri.COLL_FLG != null && ri.COLL_FLG.ToLower() == "t") ? ri.LNRATE.Value.ToString() : EQ.FEE_AMT;

                    if (ri.CASH != null && ri.CASH.ToLower() == "n")
                    {
                        EQ.FEE_AMT = ri.LNRATE.Value.ToString();
                    }
                    else
                    {
                        EQ.FEE_AMT = EQ.FEE_AMT;
                    }

                    //if cash n and coll flg c then

                    EQ.DIVIDEND_RATE_PCT = ri.DIV_AGE.ToString();
                    EQ.DIVIDEND_TRACKING_IND = ri.LNT_DIV_TRACKING;

                    switch (ri.CASH.ToUpper())
                    {
                        case "C": EQ.COLLATERAL_TYPE_CD = "CA";
                            break;
                        case "N": EQ.COLLATERAL_TYPE_CD = "NC";
                            break;
                        case "T": EQ.COLLATERAL_TYPE_CD = "CP";
                            break;
                        default: EQ.COLLATERAL_TYPE_CD = "CA";
                            break;
                    }

                    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;
                }

            }
        }
Beispiel #51
0
        private async Task GetAllNotesAndUpdate()
        {
            Offline = !App.Cloud.IsConnected();
            if (Offline)
            {
                return;
            }

            GettingLatestNotes = true;

            var notes = await App.Cloud.GetAllNotes();

            if (notes == null) // null if we time out trying to connect
            {
                return;
            }

            string cloudKey = SelectedNote?.CloudKey;

            // Loop through the notes backwards so as to remove them if needed
            for (int i = _notes.Count - 1; i >= 0; i--)
            {
                // Note exists in cloud - update if necessary
                if (notes.ContainsKey(_notes[i]?.CloudKey ?? ""))
                {
                    if (notes[_notes[i].CloudKey].LastModified > _notes[i].LastModified) // Cloud note is newer
                    {
                        await App.Cloud.GetNoteWithContent(_notes[i].NoteData);

                        await App.Local.UpdateNote(_notes[i].NoteData);
                    }
                    else if (notes[_notes[i].CloudKey].LastModified < _notes[i].LastModified) // Local note is newer
                    {
                        await App.Cloud.UpdateNote(_notes[i].NoteData);
                    }

                    notes.Remove(_notes[i].CloudKey);
                }
                // Note no longer exists in cloud, delete locally and in localDB
                else if (!notes.ContainsKey(_notes[i]?.CloudKey ?? ""))
                {
                    await App.Local.DeleteNote(_notes[i].NoteData);

                    _notes.RemoveAt(i);
                }
            }

            // These are the new notes coming from the cloud
            foreach (Note note in notes.Values)
            {
                await App.Cloud.GetNoteWithContent(note);

                _notes.Add(new NoteViewModel(note));
                await App.Local.AddNote(note);
            }

            if (String.IsNullOrEmpty(cloudKey) && _notes.Count > 0)
            {
                SelectedNote = _notes[0];
            }
            else
            {
                SelectedNote = _notes.Where(x => x.CloudKey == cloudKey).FirstOrDefault();
            }

            // Forces a refresh on the converter!
            foreach (var note in _notes)
            {
                note.ForceLastModifiedConverterRefresh();
            }

            GettingLatestNotes = false;
        }
Beispiel #52
0
        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);
            }
        }
 /// <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;
     }
 }