Ejemplo n.º 1
0
 public MirakurunViewerView()
 {
     //services = new MirakurunService("http://127.0.0.1:40772/");
     try
     {
         services = new MirakurunService(SettingObj.Read());
     }
     catch (System.Net.WebException ex)
     {
         System.Windows.MessageBox.Show(ex.Message +
                                        "\nPlease make sure server is up online." +
                                        "\nServer_ADDR:[" + SettingObj.Read().Mirakurun_ServiceAddr + "]",
                                        "ERROR",
                                        System.Windows.MessageBoxButton.OK,
                                        System.Windows.MessageBoxImage.Error);
         Environment.Exit(1);
     }
     catch
     {
         Environment.Exit(1);
     }
     _ChannelList = new Dictionary <ChannelType, ObservableCollection <Apis.Service> >();
     _ChannelList.Add(ChannelType.GR, new ObservableCollection <Apis.Service>(services.GetServices(cType: ChannelType.GR)));
     _ChannelList.Add(ChannelType.BS, new ObservableCollection <Apis.Service>(services.GetServices(cType: ChannelType.BS)));
     _ChannelList.Add(ChannelType.CS, new ObservableCollection <Apis.Service>(services.GetServices(cType: ChannelType.CS)));
     _ChannelList.Add(ChannelType.SKY, new ObservableCollection <Apis.Service>(services.GetServices(cType: ChannelType.SKY)));
     this.pTicks           = new Timer();
     this.pTicks.Interval  = 1000;
     this.pTicks.Elapsed  += this.pTick_Tick;
     this.pTicks.AutoReset = true;
     this.pTicks.Start();
 }
Ejemplo n.º 2
0
        public DBItemChangeViewModel(string id, string name, string path, long time, bool uploaded, bool visable, Database db)
        {
            this.ID         = id;
            this.Name       = name;
            this.Path       = path;
            this.Time       = time;
            this.IsUploaded = uploaded;
            this.Visable    = visable;
            this.root       = SettingObj.Read().StorageFolder;
            this.NewFiles   = new ObservableCollection <FileItemView>();
            var t = new FileInfo(System.IO.Path.Combine(root, this.Path)).DirectoryName;

            if (Directory.Exists(t))
            {
                this.fPath = t;
            }
            else
            {
                fPath = string.Empty;
            }
            string tmp = path;

            try
            {
                tmp = System.IO.Path.Combine(root, tmp);
            }
            finally
            {
                this.NewFiles.Add(tmp);
            }
            InitFolder();

            this.mDB = db;
        }
Ejemplo n.º 3
0
 public RecordListViewViewModel()
 {
     Setting    = SettingObj.Read();
     _mainTable = new DataSet();
     if (Setting.DataBase != "mysql")
     {
         throw new InvalidOperationException("Database type is unsupported!");
     }
     System.Threading.ThreadPool.QueueUserWorkItem(x => {
         database = new Database(Setting.DataBase_Addr, Setting.DataBase_User, Setting.DataBase_Pw, Setting.DataBase_Port ?? 3306);
         IsReady  = true;
     });
 }
Ejemplo n.º 4
0
 public SettingViewModel()
 {
     data = SettingObj.Read();
 }