コード例 #1
0
        /// <summary>
        /// Delete all user playlist
        /// </summary>
        public void DeleteAllUserPlaylist()
        {
            // Check if engine is play a song in a user playlist => stop and change current playlist to recently added
            if (Playlists != null)
            {
                if (Playlists.Contains(CurrentPlaylist))
                {
                    Stop();
                    CurrentPlaylist = AllSongs;
                }

                // Delete all user playlists
                for (int i = 0; i < Playlists.Count; i++)
                {
                    if (Playlists[i].Prio == Playlist.Priority.User)
                    {
                        if (Playlists[i].Name == SelectedPlaylist.Name)
                        {
                            SelectedPlaylist = AllSongs;
                        }
                        Playlists.Remove(Playlists[i]);
                    }
                }

                ViewSource.Refresh();
            }
        }
コード例 #2
0
ファイル: PlaylistBase.cs プロジェクト: hustacle/AMP-1
        public async Task <int> RemoveDuplicates()
        {
            int counter = Tracks.Count;
            List <PlayableBase> noduplicates = null;
            await Task.Run(() => noduplicates = Tracks.Distinct(new TrackComparer()).ToList());

            if (noduplicates.Count <= 0 || noduplicates.Count == Tracks.Count)
            {
                return(counter - noduplicates.Count);
            }

            var duplicateList = Tracks.ToList();

            foreach (var noduplicate in noduplicates)
            {
                duplicateList.Remove(noduplicate);
            }

            foreach (var track in duplicateList)
            {
                RemoveTrack(track);
            }
            ViewSource.Refresh();

            return(counter - noduplicates.Count);
        }
コード例 #3
0
 public HamlDocument ParseViewSource(ViewSource layoutViewSource)
 {
     using (var streamReader = layoutViewSource.GetTextReader())
     {
         return(ParseStreamReader(streamReader, layoutViewSource.FileName));
     }
 }
コード例 #4
0
ファイル: DiffDocViewModel.cs プロジェクト: cocoon/Aehnlich
 /// <summary>The parent viewmodel supports this callback method to inform the parent that the IsDirty property has changed its value.</summary>
 /// <param name="source"></param>
 /// <param name="oldValue"></param>
 /// <param name="newValue"></param>
 public void IsDirtyChangedCallback(ViewSource source, bool oldValue, bool newValue)
 {
     if (_diffSideViewModelParent != null)
     {
         _diffSideViewModelParent.IsDirtyChangedCallback(source, oldValue, newValue);
     }
 }
コード例 #5
0
        /// <summary>
        /// Remove a benhnhan object from list, DB and refresh the view
        /// </summary>
        /// <param name="bn"></param>
        public async Task Remove(BENHNHAN bn)
        {
            //await Task.Run(() => Helper.RemoveBenhNhan(bn));
            await Task.Run(() => Helper.RemovePhieuKham(bn));

            DS_KhamBenh.Remove(bn);
            ViewSource.Refresh();
        }
コード例 #6
0
        /// <summary>
        /// Add a new benhnhan object to list, DB and refresh the view
        /// </summary>
        /// <param name="bn"></param>
        public async Task Add(BENHNHAN bn)
        {
            //await Task.Run(() => Helper.AddBenhNhan(bn));
            await Task.Run(() => Helper.AddPhieuKham(bn));

            DS_KhamBenh.Add(bn);
            ViewSource.Refresh();
        }
コード例 #7
0
 public void SelectAll()
 {
     foreach (var o in DocumentSelectionList)
     {
         o.Selected = true;
     }
     ViewSource.Refresh();
 }
コード例 #8
0
 public void SelectNone()
 {
     foreach (var o in DocumentSelectionList)
     {
         o.Selected = false;
     }
     ViewSource.Refresh();
 }
コード例 #9
0
        Gerar_conteudo_basico()
        {
            var source = new ViewSource(new EditarView(metadata), new FileHelper(), "Editar");
            var gerado = source.Content();
            var infro  = source.Info();

            Assert.IsNotNull(gerado);
        }
コード例 #10
0
        public static async Task <ItemsGetter> Fetch(ApiProvider apiProvider, ViewSource vs)
        {
            string fetchUrl = apiProvider.Api + vs.RequestPath;
            var    response = await apiProvider.Client.GetAsync(new Uri(fetchUrl));

            asapJson.JsonNode responseNode = new asapJson.JsonNode(await response.Content.ReadAsStringAsync(), true);
            response.Dispose();
            return(new ItemsGetter(responseNode, vs, apiProvider));
        }
コード例 #11
0
 private void LoadLists()
 {
     using (var dc = new QLPM_ModelDataContext())
     {
         dc.THUOCs.Select(x => x).ToList().ForEach(x => DS_Thuoc.Add(x));
         dc.CACHDUNGs.Select(x => x).ToList().ForEach(x => DS_CachDung.Add(x));
     }
     ViewSource.Refresh();
 }
コード例 #12
0
        public static string LoadDocuments(string LoadFolderPath, string ArchiveFolderPath, string PassportFolderID, string TemplateCardID, UserSession Session)
        {
            string   TextResult     = "";
            CardData TemplateCard   = Session.CardManager.GetCardData(new Guid(TemplateCardID));
            Folder   PassportFolder = ((FolderCard)Session.CardManager.GetDictionary(FoldersCard.ID)).GetFolder(new Guid(PassportFolderID));
            CardData refUniversal   = Session.CardManager.GetDictionaryData(RefUniversal.ID);

            List <RawView> passportsRawView = Session.CardManager.GetViewData(ViewSource.FromFolder(new Guid(PassportFolderID)))
                                              .Select(ir => new RawView
            {
                Description = ir.GetString(DigestViewColumns.Description),
                InstanceId  = ir.GetGuid(DigestViewColumns.InstanceId)
            }).ToList();


            IEnumerable <Protocol> allProtocols = GetProtocols(LoadFolderPath);

            logger.Info("Найдено файлов:" + allProtocols.Count());

            IEnumerable <Protocol> parsedProtocols    = allProtocols.Where(p => p.IsParsed).ToList();
            IEnumerable <Protocol> incorrectProtocols = allProtocols.Where(p => !p.IsParsed).ToList();

            string incorrectProtocolsList = "";

            foreach (Protocol pr in incorrectProtocols)
            {
                incorrectProtocolsList += "\n" + pr.PhysicalFile.FullName;
            }
            logger.Info("Не распознаны следующие файлы: {0}", incorrectProtocolsList);
            TextResult = TextResult + "Не распознаны следующие файлы: {0}" + incorrectProtocolsList + "\n";

            foreach (Protocol pp in parsedProtocols)
            {
                try
                {
                    string RegisterProtocolResult = "";
                    if (RegisterProtocol(pp, passportsRawView, Session, TemplateCard, PassportFolder, refUniversal, out RegisterProtocolResult))
                    {
                        File.Move(pp.PhysicalFile.FullName, pp.PhysicalFile.FullName.Replace(LoadFolderPath, ArchiveFolderPath));
                    }
                    TextResult = TextResult + RegisterProtocolResult;
                }
                catch (Exception ex)
                {
                    logger.ErrorException(string.Format("Register error: {0}", pp.PhysicalFile.FullName), ex);
                    TextResult = TextResult + "Ошибка регистрации:\n" + pp.PhysicalFile.FullName + ". " + ex.ToString() + "\n";
                }
            }

            foreach (var ic in incorrectProtocols)
            {
                logger.Info("Файл не соответсвует формату:\n{0}", ic.PhysicalFile.FullName);
                TextResult = TextResult + "Файл не соответсвует формату:\n" + ic.PhysicalFile.FullName + "\n";
            }
            return(TextResult);
        }
コード例 #13
0
        private ViewSource GetPartial(ViewSourceCollection viewSourceList, string partialName)
        {
            ViewSource viewSource = viewSourceList.GetByPartialName(partialName)
                                    ?? _contentProvider.GetViewSource(partialName);

            if (viewSource == null)
            {
                throw new PartialNotFoundException(partialName);
            }
            return(viewSource);
        }
コード例 #14
0
 /// <summary>class constructor</summary>
 /// <param name="source"></param>
 /// <param name="isDirty"></param>
 /// <param name="filePath"></param>
 /// <param name="changeType"></param>
 public DocumentPropertyChangedEvent(ViewSource source
                                     , bool isDirty
                                     , string filePath
                                     , DocumentPropertyChangeType changeType)
     : this()
 {
     Source     = source;
     ChangeType = changeType;
     IsDirty    = isDirty;
     FilePath   = filePath;
 }
コード例 #15
0
        /// <summary>
        /// Delete one given playlist
        /// </summary>
        /// <param name="playlist"></param>
        public void DeleteOnePlaylist(Playlist playlist)
        {
            if (playlist.Prio == Playlist.Priority.User && playlist.CanEdit)
            {
                // Check if engine is play a song in a user playlist => stop and change current playlist to AllSongs
                if (CurrentPlaylist == playlist)
                {
                    Stop();
                    CurrentPlaylist = AllSongs;
                }

                Playlists.Remove(playlist);
                ViewSource.Refresh();
            }
        }
コード例 #16
0
 private ItemsGetter(asapJson.JsonNode node, ViewSource vs, ApiProvider apiProvider)
 {
     this.View    = vs;
     this.AtEnd   = node.getValue_Object()["atEnd"].getValue_Boolean();
     this.AtStart = node.getValue_Object()["atStart"].getValue_Boolean();
     this.Items   = new List <Image>();
     foreach (var it in node.getValue_Object()["items"].getValue_Array())
     {
         this.Items.Add(new Image(it));
     }
     this.Timestamp = ApiProvider.UnixTimestamp0.AddSeconds(node.getValue_Object()["ts"].getValue_Number());
     this.Cache     = node.getValue_Object()["cache"].getValue_String();
     this.Rt        = (long)node.getValue_Object()["rt"].getValue_Number();
     this.Qc        = (long)node.getValue_Object()["qc"].getValue_Number();
     this.Provider  = apiProvider;
 }
コード例 #17
0
        /// <summary>
        /// Searching by multi-criteria
        /// </summary>
        private void Search()
        {
            if (string.IsNullOrWhiteSpace(SearchText))
            {
                GetList();
                return;
            }

            var criterias = SearchText.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < criterias.Length; i++)
            {
                criterias[i] = criterias[i].ToUpper();
            }

            ViewSource.Filter = item => string.IsNullOrWhiteSpace(SearchText) || item.ToString().ToUpper().ContainsAll(criterias);
            ViewSource.Refresh();
        }
コード例 #18
0
        public DMesCoreViewModel()
        {
            ViewSource.Add(CpmsTab);
            ViewSource.Add(SchTaskTab);
            ViewSource.Add(AlarmTab);
            ViewSource.Add(ScanMaterialTab);
            ViewSource.Add(Com485Tab);
            //ViewSource.Add(DpmsTab);
            ViewSource.Add(CpmDetailTab);
            //ViewSource.Add(WireOdPieTab);
            ViewSource.Add(ProcessCheckTab);

            actionExecDict[DMesActions.RFID_ACCPET]           = whenRfidAccept;
            actionExecDict[MqActions.SCAN_MATERIAL_ACCEPT]    = whenScanMaterialAccpet;
            actionExecDict[DMesActions.CLEAR_SCH_TASKS]       = clearSchTask;
            actionExecDict[CpmActions.UNREGISTERED_IP_ACTIVE] = unRegIpActived;
            actionExecDict[MqActions.SCH_TASK_REPLACED]       = whenSchTaskReplaced;
        }
コード例 #19
0
        /// <summary>The parent viewmodel supports this callback method to inform the parent that the IsDirty property has changed its value.</summary>
        /// <param name="source"></param>
        /// <param name="oldValue"></param>
        /// <param name="newValue"></param>
        public void IsDirtyChangedCallback(ViewSource source, bool oldValue, bool newValue)
        {
            string filename = string.Empty;

            switch (source)
            {
            case ViewSource.Left:
                filename = DiffCtrl.ViewA.FileName;
                break;

            case ViewSource.Right:
                filename = DiffCtrl.ViewB.FileName;
                break;

            default:
                throw new NotImplementedException(source.ToString());
            }

            DocumentPropertyChanged?.Invoke(this, new DocumentPropertyChangedEvent(source, newValue, filename, DocumentPropertyChangeType.IsDirty));
        }
コード例 #20
0
        static int Main(string[] aArgs)
        {
            var program = new ViewSource();

            try
            {
                program.Run(aArgs);
            }
            catch (Exception e)
            {
                Console.WriteLine("vs [filename] [width] [depth]");
                Console.WriteLine("[filename] = audio file to process");
                Console.WriteLine("[width] = number of shapes across");
                Console.WriteLine("[height] = number of shapes down");
                Console.WriteLine(e.Message);
                return 1;
            }

            return 0;
        }
コード例 #21
0
        public HamlDocument BuildHamlDocument(ViewSourceCollection viewSourceList)
        {
            _hamlDocumentCache.Clear();
            var hamlDocument = HamlDocumentCacheGetOrAdd(viewSourceList.First().FileName,
                                                         () => _treeParser.ParseViewSource(viewSourceList.First()));

            var masterPage = GetMasterPage();

            hamlDocument = ApplyMasterPage(hamlDocument, masterPage);

            HamlNodePartial partial;

            while ((partial = hamlDocument.GetNextUnresolvedPartial()) != null)
            {
                ViewSource viewSource = GetPartial(viewSourceList, partial.Content);

                var partialDocument = HamlDocumentCacheGetOrAdd(viewSource.FileName,
                                                                () => _treeParser.ParseViewSource(viewSource));
                partial.SetDocument(partialDocument);
            }
            return(hamlDocument);
        }
コード例 #22
0
        /// <summary>
        /// Delete one given track
        /// </summary>
        /// <param name="track"></param>
        public void DeleteOneTrack(Track track)
        {
            // Kick out current track
            if (track == CurrentTrack)
            {
                Stop();
                CurrentTrack = Playlist.NextTrack(CurrentPlaylist, CurrentTrack);
            }

            // If playlist is application and can not edit => return
            if (!SelectedPlaylist.CanEdit && SelectedPlaylist.Prio == Playlist.Priority.Application)
            {
                return;
            }
            // In case selected playlist is current playlist
            else if (CurrentPlaylist.DateCreated == SelectedPlaylist.DateCreated)
            {
                // In case that current playlist is All Songs
                if (SelectedPlaylist.CanEdit && SelectedPlaylist.Prio == Playlist.Priority.Application)
                {
                    RemoveSelecurrent(track);
                    Updater.DeleteOneTrack(track);
                }
                RemoveSelecurrent(track);
            }
            // In case All Songs playlist
            else if (SelectedPlaylist.CanEdit && SelectedPlaylist.Prio == Playlist.Priority.Application)
            {
                RemoveInAllSongs(track);
            }
            // In case User's playlist
            else if (SelectedPlaylist.Prio == Playlist.Priority.User)
            {
                RemoveSelecPL(track);
            }

            ViewSource.Refresh();
        }
コード例 #23
0
 /// <summary>Class constructor</summary>
 /// <param name="source"></param>
 /// <param name="diffSideViewModelParent"></param>
 public DiffSideViewModel(ViewSource source, IDiffSideViewModelParent diffSideViewModelParent)
     : this()
 {
     this._thisDataSource          = source;
     this._diffSideViewModelParent = diffSideViewModelParent;
 }
コード例 #24
0
 private void ImageButton_OnClicked(object sender, EventArgs e)
 {
     ViewSource?.Invoke(this, EventArgs.Empty);
 }
コード例 #25
0
 public TemplateFactory CompileTemplateFactory(string className, ViewSource viewSource)
 {
     return(CompileTemplateFactory(className, new ViewSourceCollection {
         viewSource
     }, typeof(TemplateBase.Template)));
 }
コード例 #26
0
 public TemplateFactory GetCompiledTemplate(ViewSource viewSource, Type templateBaseType)
 {
     return(GetCompiledTemplate(new ViewSourceCollection {
         viewSource
     }, templateBaseType));
 }