예제 #1
0
        public ActionResult AddMemory()
        {
            var rp  = new MemoryRepo(new MemoryMssql());
            var cvm = new MemoryViewModel((Computer)Session["CurrentBuild"], rp.GetAll());

            return(View(cvm));
        }
예제 #2
0
 public TracingUI()
 {
     InitializeComponent();
     SocketCommon.InitSocket();
     HttpCommon.InitHttp();
     DataContext = new MemoryViewModel();
 }
예제 #3
0
        public CreateMemoryPage()
        {
            InitializeComponent();
            TitleBarControl.SetBackButtonVisibility(Visibility.Visible);
            // 设置为多选
            GalleryGridViewControl.SetGridViewMultipleSelection();
            // 标题box
            TitleBox.Text = new DateTimeFormatter("longdate").Format(DateTime.Now);
            // 完成button
            DoneButton.Click += async(sender, args) =>
            {
                if (_memoryListView == null)
                {
                    return;
                }
                // 新建一个回忆VM
                var memoryViewModel = await MemoryViewModel.GetInstanceAsync();

                memoryViewModel.KeyNo           = _memoryListView.LastKeyNo + 1;
                memoryViewModel.MemoryName      = TitleBox.Text;
                memoryViewModel.ImageViewModels = GalleryGridViewControl.SelectedImageViewModels;
                memoryViewModel.CoverImage      = memoryViewModel.ImageViewModels[0].ThumbnailImage;
                _memoryListView.Add(memoryViewModel);
                GoBack();
            };
            // 取消button
            CancelButton.Click += (sender, args) => { GoBack(); };
        }
예제 #4
0
 public List <MemoryViewModel> GetMemoryInfos()
 {
     try
     {
         using (var scope = new SQLServerDBContextScope(this.mDBConnect))
         {
             SQLServerDBRepertory   db          = new SQLServerDBRepertory();
             List <RingBuffer>      buffers     = db.Filter <RingBuffer, DateTime>(d => d.Type == "RING_BUFFER_SCHEDULER_MONITOR" && d.Record.Contains("<SystemHealth>"), d => d.EventTime);
             SystemInfo             system      = db.Find <SystemInfo>(d => d.PhysicalMemory > 0);
             List <MemoryViewModel> memoryInfos = new List <MemoryViewModel>();
             foreach (RingBuffer buffer in buffers)
             {
                 MemoryViewModel info = RingBufferHelper.ParseXMLToMemoryInfo(buffer.Record);
                 info.TotalMemory = system.PhysicalMemory;
                 info.UseMemory   = Convert.ToInt32(system.PhysicalMemory * ((double)info.MemoryUtilization / 100));
                 info.EventTime   = buffer.EventTime.ToLocalTime().ToString();
                 memoryInfos.Add(info);
             }
             return(memoryInfos);
         }
     }
     catch (Exception e)
     {
         throw;
     }
 }
예제 #5
0
        public ActionResult Memory(int computerId)
        {
            var cr  = new ComputerRepo(new ComputerMssql());
            var mr  = new MemoryRepo(new MemoryMssql());
            var mvm = new MemoryViewModel(cr.GetById(computerId), mr.GetAll());

            return(View(mvm));
        }
 public CalculatorViewModel(CalculatorView view)
 {
     calculator      = new Calculator();
     screen          = calculator.Screen;
     pvm             = new PadViewModel(calculator);
     svm             = new ScreenViewModel(calculator.Screen);
     mvm             = new MemoryViewModel(/*dummy*/);
     pvm.PadPressed += c_PadPressedHandler;
 }
        WeakReference ReleaseTarget_CanExecutePrivateCore()
        {
            MemoryViewModel commandContainer = new MemoryViewModel();
            WeakReference   reference        = new WeakReference(commandContainer);

            commandContainer.CreatePrivateCommand((x1, x2) => CreateCommand(x1, x2));
            commandContainer.CreateInternalCommand((x1, x2) => CreateCommand(x1, x2));
            commandContainer = null;
            return(reference);
        }
        public SystemFileViewModel()
        {
            _systemViewModel        = new SystemViewModel(new SystemModel());
            _defaultMemoryViewModel = new MemoryViewModel(new MemoryModel());

            OpenSystemWindowSetupTab       = new RelayCommand(() => _systemViewModel.Show(SystemTab.SETUP));
            OpenSystemWindowInputOutputTab = new RelayCommand(() => _systemViewModel.Show(SystemTab.INPUT_OUTPUT));
            OpenSystemWindowUSBTab         = new RelayCommand(() => _systemViewModel.Show(SystemTab.USB));
            OpenSystemWindowMIDITab        = new RelayCommand(() => _systemViewModel.Show(SystemTab.MIDI));
        }
예제 #9
0
        public static MemoryViewModel ParseXMLToMemoryInfo(string xml)
        {
            XElement        rooeElement           = XElement.Parse(xml);
            XElement        schedulerMonitorEvent = rooeElement.Element("SchedulerMonitorEvent");
            XElement        systemHealth          = schedulerMonitorEvent.Element("SystemHealth");
            MemoryViewModel info = new MemoryViewModel();

            info.MemoryUtilization = Convert.ToInt32(systemHealth.Element("MemoryUtilization").Value);
            return(info);
        }
예제 #10
0
        public void ReleaseTarget_CanExecutePrivate()
        {
            MemoryViewModel commandContainer = new MemoryViewModel();
            WeakReference   reference        = new WeakReference(commandContainer);

            commandContainer.CreatePrivateCommand((x1, x2) => CreateCommand(x1, x2));
            commandContainer.CreateInternalCommand((x1, x2) => CreateCommand(x1, x2));
            Assert.IsTrue(reference.IsAlive);
            commandContainer = null;
            MemoryLeaksHelper.EnsureCollected(reference);
        }
예제 #11
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            _memoryViewModel = e.Parameter as MemoryViewModel;
            _test            = _memoryViewModel?.ImageViewModels;
            var photoClustering = new PhotoClustering(_test);

            _wayPoint         = photoClustering.GetPhotoClustering();
            _test             = photoClustering.UpdateImageList(); //去掉没有GPS的图片
            _clusteringResult = photoClustering.GetClusteringResult();
            DelayGetPath();                                        //得出路径
        }
예제 #12
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            // connected animation
            var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("CoverImage");

            animation?.TryStart(CoverImage);

            var memoryDetailParameters = e.Parameter as MemoryDetailParameters;

            _memoryViewModel              = memoryDetailParameters?.MemoryViewModel;
            _memoryListViewModel          = memoryDetailParameters?.MemoryListViewModel;
            PhotoGridView.MemoryViewModel = _memoryViewModel;
        }
예제 #13
0
        public GameBoyViewModel(IGameBoy gameBoy, IDispatcher dispatcher, IWindow window, 
                                IOpenFileDialogFactory fileDialogFactory, 
                                IKeyboardHandler keyboardHandler)
        {
            _gameBoy = gameBoy;
            _dispatcher = dispatcher;
            _window = window;
            _keyboardHandler = keyboardHandler;
            _keyboardHandler.KeyDown += OnKeyDown;
            _keyboardHandler.KeyUp += OnKeyUp;
            _window.OnClosing += HandleClosing;

            _buttonMapping = new ButtonMapping();

            _memory = new MemoryViewModel(_gameBoy.Memory, "Memory View");
            _cpu = new CPUViewModel(_gameBoy, _dispatcher);

            // TODO(aaecheve): Should this be another function handling this?
            _gameBoy.CPU.BreakpointFound += BreakpointHandler;
            _gameBoy.CPU.InterruptHappened += InterruptHandler;
            _gameBoy.ErrorEvent += _gameBoy_ErrorEvent;

            _interrupt = new InterruptManagerViewModel(_gameBoy, _dispatcher);
            _ioRegisters = new IORegistersManagerViewModel(_gameBoy, _dispatcher);
            _soundChannelInternals = new SoundChannelInternalsViewModel(_gameBoy);
            _display = new DisplayViewModel(_gameBoy, _gameBoy.Display, _gameBoy.Memory, _dispatcher);
            _gameBoyGamePad = new GameBoyGamePadViewModel(_gameBoy, _dispatcher);
            _breakpoints = new BreakpointsViewModel(_gameBoy);
            _dissasemble = new DissasembleViewModel(_breakpoints, _gameBoy);
            _instructionHistogram = new InstructionHistogramViewModel(_gameBoy, _dispatcher);
            _apu = new APUViewModel(_gameBoy, _dispatcher);
            _memoryImage = new MemoryImageViewModel(_gameBoy, _dispatcher);
            _soundRecording = new SoundRecordingViewModel(_gameBoy);
            _controls = new ControlsViewModel(this, _buttonMapping);

            // Gameboy Controller events
            _gameBoyController = new GameBoyContollerViewModel(_gameBoy, fileDialogFactory, _breakpoints);
            _gameBoyController.OnFileLoaded += FileLoadedHandler;
            _gameBoyController.OnStep += StepHandler;
            _gameBoyController.OnRun += RunHandler;
            _gameBoyController.OnPause += PauseHandler;
        }
예제 #14
0
 public void Attach(IDebuggable target)
 {
     _dataContext = new MemoryViewModel(target, this);
     _dataContext.PropertyChanged += DataContext_OnPropertyChanged;
     _dataContext.Attach();
 }