public ActionResult Index(int?totalTemplateCount) { int TemplatesLeftToUpload = Convert.ToInt32(Request.QueryString["HD_NumberTemplates"]); PackageUploadViewModel model = new PackageUploadViewModel { HD_Template = new PublishTemplateMetaDataModel(), CurrentTemplateIndex = ((totalTemplateCount - TemplatesLeftToUpload) + 1) ?? 1, TotalTemplatesCount = totalTemplateCount ?? TemplatesLeftToUpload, }; return(View(model)); }
public PackageUploadWindow(PackageUploadViewModel dialogViewModel) { _dialogViewModel = dialogViewModel; InitializeComponent(); DataContext = _dialogViewModel; // Intialize drop HandlerAssembliesList.AllowDrop = true; HandlerAssembliesList.DragEnter += FileList_DragEnter; HandlerAssembliesList.Drop += HandlerAssembliesList_Drop; DependencyList.AllowDrop = true; DependencyList.DragEnter += FileList_DragEnter; DependencyList.Drop += DependencyList_Drop; }
public ActionResult Index(PackageUploadViewModel model) { string packageName = Path.ChangeExtension(model.HD_Template.Title0, "hdpkg"); string packageLocation = Path.Combine(@"C:\temp5\", packageName); using (FileStream newFile = System.IO.File.Create(packageLocation)) { model.HD_Upload0.InputStream.Seek(0, SeekOrigin.Begin); model.HD_Upload0.InputStream.CopyTo(newFile); } int currentTemplateIndex = Convert.ToInt32(Request.Form["hdnCurrentTemplateIndex"]); if (currentTemplateIndex == model.TotalTemplatesCount) { return(View("Published")); } return(Index(model.TotalTemplatesCount)); }
static SampleDataContext() { MainInfoViewModel = new MainInfoViewModel { TotalMemory = 123456789, UsedMemory = 103456789, Cpu = 12.442112f, IsConnected = true }; // Handlers MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 1", HandlerName = "Handler 1", JobName = "Job 1", HandlerState = HandlerState.Running, TotalJobsAvailable = 12323145, JobsPending = 10, JobsAvailable = 15123, TotalJobsProcessed = 63366, TotalJobsFailed = 12, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 2", HandlerName = "Handler 1", JobName = "Job 3", HandlerState = HandlerState.Stopped, TotalJobsAvailable = 445, JobsPending = 0, JobsAvailable = 0, TotalJobsProcessed = 744, TotalJobsFailed = 454, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 3", HandlerName = "Handler 2", JobName = "Job 1", HandlerState = HandlerState.Finished, TotalJobsAvailable = 0, JobsPending = 0, JobsAvailable = 0, TotalJobsProcessed = 77744, TotalJobsFailed = 1, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); // Clients MainInfoViewModel.Clients.Add(new ClientInfoViewModel { Id = Guid.NewGuid(), Name = "Client 1", Version = "1.0.0.60", TotalMemory = 8589934592, UsedMemory = RandomGenerator.Instance.NextUInt64(0, 8589934592), Cpu = (float)(RandomGenerator.Instance.NextDouble() * 100), JobsInProgress = RandomGenerator.Instance.Next(0, 10), TotalJobsFailed = RandomGenerator.Instance.Next(0, 100), TotalJobsProcessed = RandomGenerator.Instance.Next(0, 10000), LastUpdate = DateTime.Now.AddMinutes(-1) }); MainInfoViewModel.Clients.Add(new ClientInfoViewModel { Id = Guid.NewGuid(), Name = "Client 2", Version = "1.0.0.60", TotalMemory = 8589934592, UsedMemory = RandomGenerator.Instance.NextUInt64(0, 8589934592), Cpu = (float)(RandomGenerator.Instance.NextDouble() * 100), JobsInProgress = RandomGenerator.Instance.Next(0, 10), TotalJobsFailed = RandomGenerator.Instance.Next(0, 100), TotalJobsProcessed = RandomGenerator.Instance.Next(0, 10000), LastUpdate = DateTime.Now.AddMinutes(-2) }); MainInfoViewModel.Clients.Add(new ClientInfoViewModel { Id = Guid.NewGuid(), Name = "Client 3", Version = "1.0.0.59", TotalMemory = 8589934592, UsedMemory = RandomGenerator.Instance.NextUInt64(0, 8589934592), Cpu = (float)(RandomGenerator.Instance.NextDouble() * 100), JobsInProgress = RandomGenerator.Instance.Next(0, 10), TotalJobsFailed = RandomGenerator.Instance.Next(0, 100), TotalJobsProcessed = RandomGenerator.Instance.Next(0, 10000), LastUpdate = DateTime.Now.AddMinutes(-3) }); MainInfoViewModel.Clients.Add(new ClientInfoViewModel { Id = Guid.NewGuid(), Name = "Client 4", Version = "1.0.0.60", TotalMemory = 8589934592, UsedMemory = RandomGenerator.Instance.NextUInt64(0, 8589934592), Cpu = (float)(RandomGenerator.Instance.NextDouble() * 100), JobsInProgress = RandomGenerator.Instance.Next(0, 10), TotalJobsFailed = RandomGenerator.Instance.Next(0, 100), TotalJobsProcessed = RandomGenerator.Instance.Next(0, 10000), LastUpdate = DateTime.Now.AddMinutes(-5) }); PackageUploadViewModel = new PackageUploadViewModel { PackageName = @"ExamplePackage" }; PackageUploadViewModel.HandlerAssemblies.Add("handler1.dll"); PackageUploadViewModel.HandlerAssemblies.Add("handler2.dll"); PackageUploadViewModel.Dependencies.Add("somefile.dll"); PackageUploadViewModel.Dependencies.Add("someotherfile.dll"); }
static SampleDataContext() { ListPopupWindowViewModel = new ListPopupWindowViewModel(); ListPopupWindowViewModel.LogInfo.Add(new LogEntryViewModel(new LogInfoEntry { Timestamp = DateTime.Now, Level = "Test", Message = "Message 1" })); ListPopupWindowViewModel.LogInfo.Add(new LogEntryViewModel(new LogInfoEntry { Timestamp = DateTime.Now, Level = "Test", Message = "Message 2" })); MainInfoViewModel = new MainInfoViewModel { TotalMemory = 123456789, UsedMemory = 103456789, Cpu = 12.442112f, IsConnected = true }; // Handlers MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 1", HandlerName = "Handler 1", JobName = "Job 1", HandlerState = HandlerState.Running, TotalJobsAvailable = 12323145, JobsPending = 10, JobsAvailable = 15123, TotalJobsProcessed = 63366, TotalJobsFailed = 12, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 2", HandlerName = "Handler 1", JobName = "Job 3", HandlerState = HandlerState.Stopped, TotalJobsAvailable = 445, JobsPending = 0, JobsAvailable = 0, TotalJobsProcessed = 744, TotalJobsFailed = 454, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 3", HandlerName = "Handler 2", JobName = "Job 1", HandlerState = HandlerState.Finished, TotalJobsAvailable = 0, JobsPending = 0, JobsAvailable = 0, TotalJobsProcessed = 77744, TotalJobsFailed = 1, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 3", HandlerName = "Handler 3", JobName = "Job 1", HandlerState = HandlerState.Idle, TotalJobsAvailable = 0, JobsPending = 0, JobsAvailable = 0, TotalJobsProcessed = 77744, TotalJobsFailed = 1, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 4", HandlerName = "Handler 4", JobName = "Job 1", HandlerState = HandlerState.Disabled, TotalJobsAvailable = 0, JobsPending = 0, JobsAvailable = 0, TotalJobsProcessed = 53, TotalJobsFailed = 0, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); MainInfoViewModel.Handlers.Add(new HandlerInfoViewModel(new HandlerInfo { Id = Guid.NewGuid(), PackageName = "Plugin 5", HandlerName = "Handler 5", JobName = "Job 1", HandlerState = HandlerState.Failed, TotalJobsAvailable = 0, JobsPending = 0, JobsAvailable = 0, TotalJobsProcessed = 0, TotalJobsFailed = 1337, LastStartTime = DateTime.Now, NextStartTime = DateTime.Now.AddMinutes(4) })); // Clients for (int i = 0; i < 5; i++) { MainInfoViewModel.Clients.Add(GenerateClientInfoViewModel()); } MainInfoViewModel.ActiveClientsCount = MainInfoViewModel.Clients.Count(i => !i.IsOffline); PackageUploadViewModel = new PackageUploadViewModel { PackageName = @"ExamplePackage" }; PackageUploadViewModel.HandlerAssemblies.Add("handler1.dll"); PackageUploadViewModel.HandlerAssemblies.Add("handler2.dll"); PackageUploadViewModel.Dependencies.Add("somefile.dll"); PackageUploadViewModel.Dependencies.Add("someotherfile.dll"); }