Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainWindowViewModel(IDialogService dialogService, IFileDialogService fileDialogService)
        {
            library = new ICRPData();

            matches = new Matches(library);

            InitilizeCommands();

            _lowerEnergy = Properties.Settings.Default.LOWERENERGY;
            _upperEnergy = Properties.Settings.Default.UPPERENERGY;
            _lowerYield  = Properties.Settings.Default.LOWERYEILD;

            matches.YeildLimit = _lowerYield;

            _xrayFilter      = true;
            _gammaFilter     = true;
            _daughtersFilter = true;

            this.dialogService     = dialogService;
            this.fileDialogService = fileDialogService;

            _selectedLines = new ArrayList();
            _nuclides      = matches.Nuclides.DefaultView;
            _nuclides.Sort = "SCORE DESC";
            _lines         = matches.Lines.DefaultView;


            SetLinesFilter();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor for LineMatches
 /// </summary>
 /// <param name="library">Libaray DataTable</param>
 public LineMatch(IDataLibrary library)
 {
     lib     = library;
     matches = new DataSet();
     matches.ReadXmlSchema(Path.Combine(Environment.CurrentDirectory, "MatchesSchema.xsd"));
     matches.Tables["PEAKS"].RowChanged += new DataRowChangeEventHandler(DataTable_RowChanged);
 }
Ejemplo n.º 3
0
 public VideoImageViewModel(SavedVideoPhotoVisualstate visualstate, IDataLibrary library, IMultiScreen multiScreen, MultimediaFolder rootfolder, MediaLibrary.DataModels.ContentType type) : this(library, multiScreen, rootfolder, type)
 {
     if (visualstate == null)
     {
         return;
     }
     this.CurrentFolder = visualstate.CurrentItem;
     this.ViewType      = visualstate.ViewType;
     if (this.ViewType == VideoPhotoViewType.NoContent && rootfolder.GetAllFilesList(null).Count > 0)
     {
         this.ViewType        = VideoPhotoViewType.Date;
         visualstate.ViewType = VideoPhotoViewType.Date;
         this.ReloadItemsCollection();
     }
     this.ComboBoxCurrentState = (int)this.ViewType;
     if (this.currentFolder == this.rootFolder || this.ViewType != VideoPhotoViewType.Folder)
     {
         this.ReloadItemsCollection();
     }
     else
     {
         this.OnItemDoubleClick(this.currentFolder);
     }
     if (visualstate.PlayerState != null)
     {
         this.savedVisualState = visualstate;
     }
 }
Ejemplo n.º 4
0
 public Task InitializeAsync(string serverAddress, string deviceAddress, IDataLibrary dataLibrary, IHttpServer httpServer)
 {
     return(Task.Factory.StartNew(() => {
         this.httpServer = httpServer as HttpServer;
         IPAddress pAddress = IPAddress.Parse(serverAddress);
         Uri uri = new Uri(string.Concat(httpServer.ServerUrl, "/description.xml"));
         this.ssdpServer = new SsdpServer();
         this.ssdpServer.RegisterNotification(DlnaServer.ServerGuid, uri, pAddress);
         this.httpServer.AddHandler(new DescriptionHandler());
         this.httpServer.AddHandler(new ContentDirectoryHandler());
         this.httpServer.AddHandler(new ControlHandler(httpServer, dataLibrary));
         this.httpServer.AddHandler(new FileHandler(dataLibrary));
         this.httpServer.AddHandler(new CoverHandler(dataLibrary));
     }));
 }
Ejemplo n.º 5
0
 public VideoImageViewModel(IDataLibrary library, IMultiScreen multiScreen, MultimediaFolder rootfolder, MediaLibrary.DataModels.ContentType type)
 {
     if (library == null)
     {
         throw new Exception("multiScreen cant work with null library");
     }
     if (multiScreen == null)
     {
         throw new ArgumentNullException("multiScreen is null");
     }
     this.dataLibrary        = library;
     this.multiScreen        = multiScreen;
     this.rootFolder         = rootfolder;
     this.ContentType        = type;
     this.IsBackVisible      = false;
     this.IsCopyPasteVisible = Visibility.Collapsed;
     this.CurrentFolder      = this.rootFolder;
     this.ViewType           = VideoPhotoViewType.Date;
     this.ReloadItemsCollection();
     this.TemporaryDataLoaded = this.dataLibrary.IsDataLoaded;
     if (type != MediaLibrary.DataModels.ContentType.Image)
     {
         this.IsMenuPlayVisible   = Visibility.Visible;
         this.ImageIconVisibility = Visibility.Collapsed;
         this.VideoIconVisibility = Visibility.Visible;
     }
     else
     {
         this.IsMenuPlayVisible   = Visibility.Collapsed;
         this.ImageIconVisibility = Visibility.Visible;
         this.VideoIconVisibility = Visibility.Collapsed;
     }
     this.addFilesCommand        = new Command(new Action <object>(this.OnAddFiles));
     this.addFolderCommand       = new Command(new Action <object>(this.OnAddFolder));
     this.RemoveFolderCommand    = new Command(new Action <object>(this.OnRemoveFolder));
     this.deleteItemCommand      = new Command(new Action <object>(this.OnDeleteItem));
     this.itemDoubleClickCommand = new Command(new Action <object>(this.OnItemDoubleClick));
     this.videoImageBackCommand  = new Command(new Action <object>(this.OnVideoImageBack));
     this.sendToQueueCommand     = new Command(new Action <object>(this.OnSendToQueue));
     this.playLocalCommand       = new Command(new Action <object>(this.OnPlayLocal));
     this.mainViewChangedCommand = new Command(new Action <object>(this.OnMainViewChanged));
     this.playOnTvCommand        = new Command(new Action <object>(this.OnPlayOnTv));
     this.dragItem            = new Command(new Action <object>(this.OnDragItem));
     this.contentDropCommand  = new Command(new Action <object>(this.OnContentDrop));
     this.cancelAddingCommand = new Command(new Action <object>(this.OnCancelAdding));
 }
 public MediaPlayerViewModel(BaseSavedVisualState savedState, IMultiScreen multiScreen, IDataLibrary dataLibrary)
 {
     if (savedState == null)
     {
         throw new ArgumentNullException("savedmusicstate");
     }
     if (multiScreen == null)
     {
         throw new ArgumentNullException("multiScreen");
     }
     if (dataLibrary == null)
     {
         throw new ArgumentNullException("dataLibrary");
     }
     this.savedViewVisualState = savedState;
     this.multiScreen          = multiScreen;
     this.dataLibrary          = dataLibrary;
     this.InitializeCommands();
 }
Ejemplo n.º 7
0
 public MainViewModel(DeviceController deviceController)
 {
     if (deviceController == null)
     {
         throw new ArgumentNullException("deviceController");
     }
     this.deviceController = deviceController;
     this.deviceController.CurrentDeviceDisconnected += new EventHandler <EventArgs>(this.deviceController_CurrentDeviceDisconnected);
     this.TargetDevice                     = this.deviceController.CurrentDevice;
     this.dataLibrary                      = this.TargetDevice.DataLibrary;
     this.remoteControlCommand             = new Command(new Action <object>(this.OnRemoteControl));
     this.multimediaCommand                = new Command(new Action <object>(this.OnMultimedia));
     this.tvVideoCommand                   = new Command(new Action <object>(this.OnTvVideo));
     this.guideCommand                     = new Command(new Action <object>(this.OnGuide));
     this.versionCommand                   = new Command(new Action <object>(this.OnVersion));
     this.licenseCommand                   = new Command(new Action <object>(this.OnLicense));
     this.slideshowSettingsCommand         = new Command(new Action <object>(this.OnSlideshowSettings));
     this.ccSettingsCommand                = new Command(new Action <object>(this.OnCCSettings));
     this.changeTVCommand                  = new Command(new Action <object>(this.OnChangeTV));
     this.dataLibrary.ContentAlreadyExist += new EventHandler(this.dataLibrary_ContentAlreadyExist);
 }
 public ControlHandler(IHttpServer httpServer, IDataLibrary dataLibrary)
 {
     this.httpServer  = httpServer;
     this.dataLibrary = dataLibrary;
     this.Prefix      = "/control";
 }
 public MultimediaAddingContentPopupViewModel(IDataLibrary dataLibrary)
 {
     this.dataLibrary = dataLibrary;
 }
Ejemplo n.º 10
0
 public FileHandler(IDataLibrary dataLibrary)
 {
     this.dataLibrary = dataLibrary;
     this.Prefix      = "/file/*";
 }
Ejemplo n.º 11
0
 public CoverHandler(IDataLibrary dataLibrary)
 {
     this.dataLibrary = dataLibrary;
     this.Prefix      = "/cover/*";
 }
Ejemplo n.º 12
0
 public SavedMultimediaVisualState(SavedMusicVisualState musicvs, SavedVideoPhotoVisualstate videovs, SavedVideoPhotoVisualstate photovs, ContentType currentview, IMultiScreen ms, IDataLibrary dl)
 {
     this.MusicVS     = musicvs;
     this.VideoVS     = videovs;
     this.PhotoVS     = photovs;
     this.CurrentView = currentview;
     this.multiscreen = ms;
     this.datalibrary = dl;
 }
 public MediaPlayerViewModel(BaseSavedVisualState savedState, IMultiScreen multiScreen, IDataLibrary dataLibrary, IEnumerable <ItemBase> files, Content selectedFile, MediaLibrary.DataModels.ContentType contentType) : this(savedState, multiScreen, dataLibrary)
 {
     if (files == null)
     {
         throw new ArgumentNullException("files");
     }
     this.ContentType = contentType;
     this.Position    = 0;
     if (contentType != MediaLibrary.DataModels.ContentType.Track)
     {
         this.files = new FileList(files);
     }
     else
     {
         this.files = new TrackList(files);
     }
     if (selectedFile != null)
     {
         this.SelectedFile = selectedFile;
         return;
     }
     this.SelectedFile = files.FirstOrDefault <ItemBase>();
 }
 public MediaPlayerViewModel(BaseSavedVisualState savedState, IMultiScreen multiScreen, IDataLibrary dataLibrary, SavedPlayerState playerState) : this(savedState, multiScreen, dataLibrary)
 {
     if (playerState == null)
     {
         throw new ArgumentNullException("PlayerState");
     }
     if (playerState.FileList == null)
     {
         throw new ArgumentNullException("files");
     }
     if (playerState.File == null)
     {
         throw new ArgumentNullException("file");
     }
     this.ContentType = playerState.ContentType;
     if (playerState.ContentType != MediaLibrary.DataModels.ContentType.Track)
     {
         this.files = new FileList(playerState.FileList);
     }
     else
     {
         this.files = new TrackList(playerState.FileList);
     }
     this.SelectedFile      = playerState.File;
     this.DefaultPosition   = new double?(playerState.Position);
     this.MediaElementState = playerState.MediaElementState;
     this.IsRepeat          = playerState.IsRepeat;
     this.IsRandom          = playerState.IsRandom;
 }
Ejemplo n.º 15
0
        /**
         * Loads a given object from node.
         * If the node contains a reference (i.e. an id or name but not the full object) then specify the reference type,
         * and library to search.
         *
         * Supported types.
         *
         * Primatives and strings
         * Data objects (referenced and full)
         * Arrays of primatives or strings
         *
         * Not implement yet: Lists of primatives, Lists or arrays of dataObjects.
         *
         */
        protected object ReadObject(XElement node, string name, Type type, FieldReferenceType referenceType = FieldReferenceType.Full, IDataLibrary library = null)
        {
            XElement sourceNode = (node.Element(name));

            if (sourceNode == null)
            {
                return(null);
            }

            // Primatives

            if (type.IsEnum)
            {
                return(ReadEnum(node, type, name));
            }

            if (type == typeof(Color))
            {
                return(ReadColor(node, name));
            }

            if (type == typeof(bool))
            {
                return(ReadBool(node, name));
            }
            if (type.IsIntType())
            {
                return(ReadInt(node, name));
            }
            if (type == typeof(float))
            {
                return(ReadFloat(node, name));
            }
            if (type == typeof(string))
            {
                return(ReadValue(node, name));
            }
            if (type == typeof(DateTime))
            {
                return(ReadDateTime(node, name));
            }

            // Data object.

            if (type.IsSubclassOf(typeof(DataObject)))
            {
                switch (referenceType)
                {
                case FieldReferenceType.ID:
                case FieldReferenceType.Name:

                    if (!type.IsSubclassOf(typeof(NamedDataObject)))
                    {
                        throw new Exception("Type must be subclass of NamedDataObject");
                    }

                    if (referenceType == FieldReferenceType.ID)
                    {
                        return(library._byID(ReadInt(node, name)));
                    }
                    else
                    {
                        return(library._byName(ReadValue(node, name)));
                    }

                case FieldReferenceType.Full:

                    var result = Activator.CreateInstance(type);
                    (result as DataObject).ReadNode(sourceNode);
                    return(result);
                }
            }

            // Serializable
            if (typeof(iSerializable).IsAssignableFrom(type))
            {
                var result = Activator.CreateInstance(type);
                (result as iSerializable).ReadNode(sourceNode);
                return(result);
            }

            // Arrays.

            if (type.IsArray)
            {
                switch (Type.GetTypeCode(type.GetElementType()))
                {
                case TypeCode.Boolean:
                    return(ReadArray <bool>(node, name));

                case TypeCode.Byte:
                    return(ReadArray <byte>(node, name));

                case TypeCode.Char:
                    return(ReadArray <char>(node, name));

                case TypeCode.DateTime:
                    return(ReadArray <DateTime>(node, name));

                case TypeCode.Double:
                    return(ReadArray <double>(node, name));

                case TypeCode.Single:
                    return(ReadArray <Single>(node, name));

                case TypeCode.Int16:
                    return(ReadArray <Int16>(node, name));

                case TypeCode.Int32:
                    return(ReadArray <Int32>(node, name));

                case TypeCode.Int64:
                    return(ReadArray <Int64>(node, name));

                case TypeCode.UInt16:
                    return(ReadArray <UInt16>(node, name));

                case TypeCode.UInt32:
                    return(ReadArray <UInt32>(node, name));

                case TypeCode.UInt64:
                    return(ReadArrayULong(node, name));
                }
            }

            // Try other types.

            if (type == typeof(BitArray))
            {
                return(ReadBitArray(node, name));
            }

            if (type.IsGenericList())
            {
                throw new Exception("Sorry, auto loading for generic lists are not yet supported for [" + type + "].");
            }

            throw new Exception("Can not read object of type " + type + " as it is not a known type.");
        }