public void AddTask() { var id = Guid.NewGuid().ToString(); var task = new Task { Title = "New RFI", Date = DateTime.UtcNow }; var taskDetailsViewModel = new TaskDetailsViewModel { Task = task, Service = Service, Plugin = Plugin, FloatingElementId = id}; var size = new Size(300, 500); var fe = FloatingHelpers.CreateFloatingElement("RFI", new Point(300, 300), size, taskDetailsViewModel); fe.Id = id; AppStateSettings.Instance.FloatingItems.AddFloatingElement(fe); }
private void AddTaskWithScreenshot() { if (Service == null) return; var id2 = Guid.NewGuid().ToString(); var task = new Task { Title = "New RFI", Date = DateTime.UtcNow }; var taskDetailsViewModel = new TaskDetailsViewModel { Task = task, Service = Service, Plugin = Plugin, FloatingElementId = id2 }; var size = new Size(300, 500); var id = Guid.NewGuid() + ".png"; var media = new Media { Id = id, LocalPath = Service.store.GetLocalUrl(Service.Folder, id), Type = MediaType.Photo, Title = task.Title }; Screenshots.SaveImageOfControl(AppStateSettings.Instance.ViewDef.MapControl, media.LocalPath); //media.Image = Screenshot as BitmapSource; foreach (var m in task.AllMedia) { try { if (File.Exists(m.LocalPath)) File.Delete(m.LocalPath); } catch (Exception) { } } task.AllMedia.Clear(); task.AllMedia.Add(media); //await Service.store.SaveBytes(id, media.ByteArray); var fe = FloatingHelpers.CreateFloatingElement("RFI", new Point(300, 300), size, taskDetailsViewModel); fe.Id = id2; AppStateSettings.Instance.FloatingItems.AddFloatingElement(fe); }
public void OpenMenu() { var taskDetailsViewModel = new TaskDetailsViewModel { Task = selectedTask, Service = Service, Plugin = Plugin, IsTaskSent = true }; var fe = FloatingHelpers.CreateFloatingElement("RFI", new Point(300, 300), new Size(300, 500), taskDetailsViewModel); taskDetailsViewModel.FloatingElementId = fe.Id; AppStateSettings.Instance.FloatingItems.AddFloatingElement(fe); }