private void ChartGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } // Modify by binhpro 19/10/2012 int id = ChartGridView.Rows[e.RowIndex].Cells[0].Value.ToInt32TryParse(); if (combochart.SelectedIndex == 0) { _sensor = SensorBLL.Current.GetByID(id); _group = null; _pictureView = null; } else if (combochart.SelectedIndex == 1) { _group = ChartViewBLL.Current.GetGroupByID(id); _sensor = null; _pictureView = null; } else if (combochart.SelectedIndex == 2) { _pictureView = PictureViewBLL.Current.GetByID(id); _sensor = null; _group = null; } BindingData(); }
void ReleaseDesignerOutlets() { if (ButtonDelete != null) { ButtonDelete.Dispose(); ButtonDelete = null; } if (DeleteButtonZoneForTouch != null) { DeleteButtonZoneForTouch.Dispose(); DeleteButtonZoneForTouch = null; } if (DetailLabel != null) { DetailLabel.Dispose(); DetailLabel = null; } if (PictureView != null) { PictureView.Dispose(); PictureView = null; } if (TitleNameLabel != null) { TitleNameLabel.Dispose(); TitleNameLabel = null; } }
void ReleaseDesignerOutlets() { if (EditPictureButton != null) { EditPictureButton.Dispose(); EditPictureButton = null; } if (PictureView != null) { PictureView.Dispose(); PictureView = null; } if (SavePictureButton != null) { SavePictureButton.Dispose(); SavePictureButton = null; } if (TakePictureButton != null) { TakePictureButton.Dispose(); TakePictureButton = null; } }
/// <summary> /// 打开图片文件 /// </summary> /// <param name="uri"></param> public void OpenPictureFile(string uri) { try { //获取文件名称(包含扩展名称) var fileName = System.IO.Path.GetFileName(uri); //本地地址 var loaclF = Constant.LocalTempRoot + "\\" + fileName; //创建一个下载管理实例 WebClientManage webClientManage = new WebClientManage(); //文件下载 webClientManage.FileDown(uri, loaclF, Constant.LoginUserName, Constant.WebLoginPassword, Constant.UserDomain, new Action <int>((intProcess) => { }), new Action <Exception, bool>((ex, IsSuccessed) => { try { if (IsSuccessed) { if (File.Exists(loaclF)) { wordManage.ClearDocuments(); pPTManage.ClearDocuments(); excelManage.ClearDocuments(); this.Dispatcher.BeginInvoke(new Action(() => { try { if (this.pictureView == null) { this.pictureView = new PictureView(loaclF); } else { this.pictureView.OpenUri(loaclF); } //加载UI事件(比如多媒体播放器,浏览器) this.book_LoadUI(this.pictureView); } catch (Exception ex2) { LogManage.WriteLog(this.GetType(), ex2); }; })); } } } catch (Exception ex2) { LogManage.WriteLog(this.GetType(), ex2); } })); } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
public ChartMainForm(Sensor sensor = null, Group group = null, PictureView pictureView = null, DateTime?startDate = null, DateTime?endDate = null) { _sensor = sensor; _group = group; _pictureView = pictureView; _startDate = startDate; _endDate = endDate; InitializeComponent(); }
public GradeViewForm() { if (!Directory.Exists(OcrData)) { var fbd = new FolderBrowserDialog(); fbd.Description = "Выберите директорию с оценками"; if (fbd.ShowDialog() == DialogResult.OK) { OcrData = fbd.SelectedPath; } else { throw new Exception("no base directory was chosen"); } } InitializeComponent(); gradePV = PictureView.InsertIntoPanel(gradePanel); digestPV = PictureView.InsertIntoPanel(digestPanel); this.Shown += new EventHandler(delegate { ProcessNextGrade(); }); KeyEventHandler keyHandler = new KeyEventHandler(delegate(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.Z) { if (actionHistory.Count > 0) { Tuple <string, string> lastAction = actionHistory.Last(); actionHistory.Remove(lastAction); File.Move(lastAction.Item2, lastAction.Item1); ProcessGrade(lastAction.Item1); } } else { Dictionary <Keys, int> gradeKeys = new Dictionary <Keys, int> { { Keys.D2, 2 }, { Keys.NumPad2, 2 }, { Keys.D3, 3 }, { Keys.NumPad3, 3 }, { Keys.D4, 4 }, { Keys.NumPad4, 4 }, { Keys.D5, 5 }, { Keys.NumPad5, 5 }, { Keys.D0, 0 }, { Keys.NumPad0, 0 } }; gradeKeys.GetOption(e.KeyCode).ForEach(grade => { MoveImageToDone(currentFileName, grade); ProcessNextGrade(); }); } }); gradePV.KeyUp += keyHandler; digestPV.KeyUp += keyHandler; }
private void BindingGrid() { try { _startDate = fromdateTextBox.Text.ToDateTimeTryParse(null); _endDate = todateTextBox.Text.ToDateTimeTryParse(null); _showCalcValue = calcRadio.Checked; if (choiseTab.SelectedTab == sensorTab && sensorGridView.SelectedRows.Count > 0) { _sensors = new List <Sensor>(); _group = null; _pictureView = null; for (int i = 0; i < sensorGridView.SelectedRows.Count; i++) { _sensors.Add(SensorBLL.Current.GetByID(sensorGridView.SelectedRows[sensorGridView.SelectedRows.Count - 1 - i].Cells["SensorID"].Value.ToInt32TryParse())); } } else if (choiseTab.SelectedTab == groupTab) { if (groupGridView.SelectedRows.Count > 0) { _group = ChartViewBLL.Current.GetGroupByID(groupGridView.SelectedRows[0].Cells["GroupID"].Value.ToInt32TryParse()); _pictureView = null; } } else if (choiseTab.SelectedTab == pictureTab) { if (pictureGridView.SelectedRows.Count > 0) { _pictureView = PictureViewBLL.Current.GetByID(pictureGridView.SelectedRows[0].Cells["PictureViewID"].Value.ToInt32TryParse()); _group = null; } } if (_group != null) { _sensors = entityConntext.Groups.SingleOrDefault(ent => ent.GroupID == _group.GroupID).Sensors.ToList(); } if (_pictureView != null) { _sensors = PictureViewBLL.Current.GetSensorsInPictureView(_pictureView); } if (_sensors != null && _sensors.Count > 0) { _sensors = _sensors.OrderBy(ent => ent.ColumnIndex).ToList(); dataGridView.DataSource = TextViewBLL.Current.BindToDataTable(_sensors, !_showCalcValue, _startDate, _endDate); } } catch (Exception exception) { //ShowErrorMessage(exception.Message); Console.WriteLine(exception.ToString()); } }
public void Validate(PictureView obj) { if (!obj.Name.IsValidLength(1, 200)) { throw new Exception(Resources.Error_PictureNameInvalid); } if (!obj.Description.IsValidLength(-1, 500)) { throw new Exception(Resources.Error_PictureDescriptionInvalid); } }
public override void ViewDidLoad() { base.ViewDidLoad(); OCR = new TesseractApi(); CaptureSession = new AVCaptureSession(); ImageOutput = new AVCapturePhotoOutput(); var cameraDevice = AVCaptureDevice.GetDefaultDevice(AVMediaType.Video); var cameraInput = AVCaptureDeviceInput.FromDevice(cameraDevice); CaptureSession.AddInput(cameraInput); CaptureSession.AddOutput(ImageOutput); SetupUI(); CaptureSession.StartRunning(); Camera = new CameraHandler(); Camera.FinishedProcessing += async delegate { PictureView.Image = new UIImage(Camera.Picture, 1f, UIImageOrientation.Right); Capture = PictureView.Capture(); await InitReader(); }; OCRButton.TouchUpInside += async delegate { HandleButtonClick(); }; AlphaNumericSwitch.ValueChanged += async delegate { await SetOcrTextLabel(); }; // Selection slider Setup SelectionBarSlider.TouchUpInside += async delegate { await InitReader(); }; SelectionBarSlider.TouchUpOutside += async delegate { await InitReader(); }; SelectionBarSlider.ValueChanged += delegate { var tempFrame = SelectionBarView.Frame; tempFrame.Y = (SelectionBarSlider.Value * 92) + 22; SelectionBarView.Frame = tempFrame; }; }
public MassGradeView(Size picSize, Func <Bitmap, Bitmap> converter) { InitializeComponent(); int W = 1900; int H = 1000; int frameW = 15; int frameH = 37; int cx = (W - frameW) / (picSize.Width + 1); int cy = (H - frameH) / (picSize.Height + 1); List <PictureView> pvs = new List <PictureView>(); for (int y = 0; y < cy; y++) { for (int x = 0; x < cx; x++) { var pv = new PictureView(); pvs.Add(pv); pv.Size = picSize; pv.Location = new Point(x * (picSize.Width + 1), y * (picSize.Height + 1)); pv.ZoomToFit(); pv.AllowZoom = false; this.Controls.Add(pv); } } this.Size = new Size(cx * (picSize.Width + 1) + frameW, cy * (picSize.Height + 1) + frameH); Console.WriteLine("placed {0} pictures in mass view", cx * cy); this.Shown += new EventHandler(delegate { Thread worker = new Thread(new ThreadStart(delegate { List <string> images = GradeFS.GetGradeFileNames(OcrData); // shuffle images Random r = new Random(); images = images.OrderBy(s => r.NextDouble()).ToList(); for (int q = 0; q < pvs.Count; q++) { string imageFile = images[q]; Bitmap img = ImageUtil.LoadImage(imageFile); pvs[q].Image = converter(img); pvs[q].DoubleClick += new EventHandler(delegate { new GradeRecognitionDebugView(img, imageFile).ShowDialog(); }); } })); worker.IsBackground = true; worker.Start(); }); }
public bool Insert(PictureView obj) { using (var entityConntext = new GeoViewerEntities()) { SecurityBLL.Current.CheckPermissionThrowException(SecurityBLL.ROLE_VIEWS_MANAGE); Validate(obj); obj.ProjectID = AppContext.Current.OpenProject.ProjectID; obj.CreatedDate = obj.LastEditedDate = DateTime.Now; obj.CreatedUser = obj.LastEditedUser = AppContext.Current.LogedInUser.Username; entityConntext.PictureViews.AddObject(obj); return(entityConntext.SaveChanges() > 0); } }
private UIElement GenImageMsgContent(string baseImage, HorizontalAlignment align) { byte[] imgData; UIElement rst; try { imgData = Convert.FromBase64String(baseImage); MemoryStream stream = new MemoryStream(imgData); BitmapImage imgSrc = new BitmapImage(); imgSrc.BeginInit(); imgSrc.StreamSource = stream; imgSrc.EndInit(); rst = new Image() { Source = imgSrc, MaxWidth = 260, AllowDrop = true, Stretch = Stretch.Uniform, HorizontalAlignment = align, }; ((Image)rst).DragLeave += Image_DragLeave; ((Image)rst).MouseDown += (s, e) => { PictureView pv = new PictureView(); pv.Picture.Source = ((Image)rst).Source; Program.Navigate(pv); }; return(rst); } catch { rst = new TextBox() { Text = "图像加载失败", Foreground = new SolidColorBrush(Color.FromRgb(200, 200, 200)), IsReadOnly = true, IsReadOnlyCaretVisible = false, MaxLines = int.MaxValue, TextWrapping = TextWrapping.Wrap, BorderThickness = new Thickness(0), BorderBrush = new SolidColorBrush(Colors.Transparent), Cursor = Cursors.Arrow }; return(rst); } }
private void btnOpenPic_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd; ofd = new OpenFileDialog(); ofd.AddExtension = true; ofd.DefaultExt = "*.*"; ofd.Filter = "Media Files (*.*)|*.*"; ofd.ShowDialog(); PictureView pv = new PictureView(); pv.imagebox.Source = new BitmapImage(new Uri(ofd.FileName)); pv.ShowDialog(); }
public bool Update(PictureView obj) { using (var entityConntext = new GeoViewerEntities()) { SecurityBLL.Current.CheckPermissionThrowException(new string[] { SecurityBLL.ROLE_VIEWS_EDIT, SecurityBLL.ROLE_VIEWS_MANAGE }); Validate(obj); obj.LastEditedDate = DateTime.Now; obj.LastEditedUser = AppContext.Current.LogedInUser.Username; entityConntext.AttachUpdatedObject(obj); return(entityConntext.SaveChanges() > 0); } }
/// <summary> /// Get list of sensors which displayed in this picture view /// </summary> /// <param name="pictureView"></param> /// <returns></returns> public List <Sensor> GetSensorsInPictureView(PictureView pictureView) { using (var entityContext = new GeoViewerEntities()) { var sensors = new List <Sensor>(); foreach (var obj in entityContext.Objects.Where(ent => ent.PictureViewID == pictureView.PictureViewID && ent.Type != OBJECT_TYPE_GROUP_INDICATOR && ent.Type != OBJECT_TYPE_IMAGE)) { var sensor = SensorBLL.Current.GetByID(obj.Parameters.ToInt32TryParse()); if (sensor != null && !sensors.Contains(sensor)) { sensors.Add(sensor); } } return(sensors); } }
private void LoadRegister(string fileName) { registerPV.Image = PictureView.LoadPlaceholder(); debugButton.Enabled = false; nextRegisterButton.Enabled = false; selectRegisterButton.Enabled = false; cell1 = null; cell2 = null; imageFileName = fileName; Thread worker = new Thread(new ThreadStart(delegate { originalImage = ImageUtil.ToBlackAndWhite(ImageUtil.LoadImage(fileName)); currentTable = TableOCR.Program.RecognizeTable(originalImage); if (currentTable.IsEmpty()) { registerPV.Invoke(new EventHandler(delegate { MessageBox.Show("Не удалось распознать таблицу"); })); } Bitmap processedImage = new Bitmap(originalImage); Graphics g = Graphics.FromImage(processedImage); currentTable.ForEach(table => { table.DrawTable(g, new Pen(Color.Red, 2)); }); g.Dispose(); registerPV.Image = processedImage; this.Invoke(new EventHandler(delegate { this.Text = fileName; })); debugButton.Invoke(new EventHandler(delegate { debugButton.Enabled = true; })); selectRegisterButton.Invoke(new EventHandler(delegate { selectRegisterButton.Enabled = true; })); nextRegisterButton.Invoke(new EventHandler(delegate { nextRegisterButton.Enabled = true; })); })); worker.IsBackground = true; worker.Start(); }
static void Main(string[] args) { TriangleModel tm1 = new TriangleModel(); Controller tc = new Controller(tm1); TriangleDigitalView tv1 = new TriangleDigitalView(tm1, tc, 40, 80, 1, 20); //tm1.AddObserver(tv1); IObserver tv2 = new PictureView(tm1, tc, 1, 39, 1, 20); //tm1.AddObserver(tv2); //аналог цикла обработки сообщений - Run bool exit = tv1.GetCommand(); while (exit != true) { exit = tv1.GetCommand(); } }
static void Main(string[] args) { TriangleModel tm1 = new TriangleModel(); IObserver tv1 = new TriangleDigitalView(tm1, null, 40, 80, 1, 20); tm1.AddObserver(tv1); IObserver tv2 = new PictureView(tm1, null, 1, 39, 1, 20); tm1.AddObserver(tv2); tm1.A = 3; Console.Read(); tm1.B = 4; Console.Read(); tm1.C = 5; Console.Read(); tm1.A = 5; Console.Read(); }
public ActionResult Edit([Bind(Include = "PictureID,Name")] PictureView pictureView, string tags) { Picture picture = _pictureRepo.Find(pictureView.PictureID); if (picture.OwnerID != User.Identity.GetUserId()) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } if (ModelState.IsValid) { picture.Tags.Clear(); picture.Name = pictureView.Name; picture.Tags = ResolveTags(tags); _pictureRepo.Update(picture); return(RedirectToAction("Index")); } return(View((PictureView)picture)); }
/// <summary> /// Pass params to display text view data on start up, set null (is default) for nothing display /// </summary> /// <param name="sensors">List sensors will be displayed</param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="showCalcValue"></param> public TextViewForm(List <Sensor> sensors = null, PictureView pictureView = null, Group group = null, DateTime?startDate = null, DateTime?endDate = null, bool showCalcValue = true) { // set value to private field _sensors = sensors; _pictureView = pictureView; _group = group; _startDate = startDate; _endDate = endDate; _showCalcValue = showCalcValue; InitializeComponent(); //BindingData(); if (_group != null) { _sensors = _group.Sensors.ToList(); } if (_pictureView != null) { _sensors = PictureViewBLL.Current.GetSensorsInPictureView(_pictureView); } dataGridView.DataSource = TextViewBLL.Current.BindToDataTable(_sensors, !_showCalcValue, _startDate, _endDate); }
public FinderCircleDebugView(Bitmap sourceImage, int minPatternRadius, int maxPatternRadius, uint inputValue, NoiseFilter noiseFilter) { InitializeComponent(); this.inputImagePV = PictureView.InsertIntoPanel(inputImagePanel); this.noiseImagePV = PictureView.InsertIntoPanel(noiseImagePanel); this.houghImagePV = PictureView.InsertIntoPanel(houghImagePanel); this.houghPeakImagePV = PictureView.InsertIntoPanel(houghPeaksImagePanel); this.peakResultImagePV = PictureView.InsertIntoPanel(peakResultImagePanel); this.dataMatrixLocationPV = PictureView.InsertIntoPanel(dataMatrixLocationPanel); this.rotatedDataMatrixPV = PictureView.InsertIntoPanel(rotatedDataMatrixPanel); this.recognizedDataMatrixPV = PictureView.InsertIntoPanel(recognizedDataMatrixPanel); this.Shown += new EventHandler(delegate { Util.NewThread(() => { Util.Timed("full AR-code OCR", () => { RunOCR(sourceImage, minPatternRadius, maxPatternRadius, inputValue, noiseFilter); }); }); }); }
private void ProcessNextImage() { Util.NewThread(() => { registerPV.Image = PictureView.LoadPlaceholder(); currentFileName = NextImageName(); this.Text = currentFileName; origImage = ImageUtil.LoadImage(currentFileName); bwImage = ImageUtil.ToBlackAndWhite(origImage); currentImage = new Bitmap(bwImage); currentTable = TableOCR.Program.RecognizeTable(currentImage); Graphics g = Graphics.FromImage(currentImage); Pen p = new Pen(Color.FromArgb(255, 255, 0, 0), 2); currentTable.ForEach(table => table.DrawTable(g, p)); g.Dispose(); registerPV.Image = currentImage; }); }
public GradeRecognitionDebugView(Bitmap inputImage, string imageName) { InitializeComponent(); this.Text = imageName; inputImagePV = PictureView.InsertIntoPanel(inputImagePanel); removeBorderPV = PictureView.InsertIntoPanel(removeBorderPanel); noiseRemovalPV = PictureView.InsertIntoPanel(noiseRemovalPanel); croppedPV = PictureView.InsertIntoPanel(croppedPanel); digestPV = PictureView.InsertIntoPanel(digestPanel); this.Shown += new EventHandler(delegate { Thread worker = new Thread(new ThreadStart(delegate { Util.Timed("Grade OCR debug run", () => { RunOCR(inputImage); }); })); worker.IsBackground = true; worker.Start(); }); }
public TableRecognitionDebugView(Bitmap sourceImage) { InitializeComponent(); sourceImagePV = PictureView.InsertIntoPanel(sourceImagePanel); bwImagePV = PictureView.InsertIntoPanel(bwImagePanel); edgePointsPV = PictureView.InsertIntoPanel(edgePointsPanel); houghPV = PictureView.InsertIntoPanel(houghPanel); cyclicPatternsPV = PictureView.InsertIntoPanel(cyclicPatternsPanel); filteredLinesPV = PictureView.InsertIntoPanel(filteredLinesPanel); normalizedLinesPV = PictureView.InsertIntoPanel(normalizedLinesPanel); tableRecognitionPV = PictureView.InsertIntoPanel(tableRecognitionPanel); recognizedTablePV = PictureView.InsertIntoPanel(recognizedTablePanel); rotBwImagePV = PictureView.InsertIntoPanel(rotBwImagePanel); rotEdgePointsPV = PictureView.InsertIntoPanel(rotEdgePointsPanel); this.Shown += new EventHandler(delegate { Util.NewThread(() => { RunOCR(sourceImage); }); }); }
void ReleaseDesignerOutlets() { if (ClientImage != null) { ClientImage.Dispose(); ClientImage = null; } if (PicPageControl != null) { PicPageControl.Dispose(); PicPageControl = null; } if (PictureScrollView != null) { PictureScrollView.Dispose(); PictureScrollView = null; } if (PictureView != null) { PictureView.Dispose(); PictureView = null; } if (ProgressRing != null) { ProgressRing.Dispose(); ProgressRing = null; } if (WelcomeLabel != null) { WelcomeLabel.Dispose(); WelcomeLabel = null; } }
private void FormView_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { try { if (e.Shift) { PictureView.SetShift(); } if (((char)e.KeyValue == 'X') && (e.Control == true)) { //CUT } else { if (((char)e.KeyValue == 'C') && (e.Control == true)) { } } } catch (Exception ex) { MessageBox.Show("d"); } }
/// <summary> /// Open selected file to display right panel. /// </summary> /// <param name="id"></param> private void PreviewById(uint id) { PackResource Res = m_Pack.GetFileByIndex(id); Status.Text = Properties.Resources.Str_LoadingPreview; this.Update(); if (Res != null) { PicturePanel.Hide(); hexBox.ResetText(); TextView.Hide(); pPlay.Hide(); String InternalName = Res.GetName(); string Ext = Path.GetExtension(@InternalName); // loading file content. byte[] buffer = new byte[Res.GetSize()]; Res.GetData(buffer); Res.Close(); MemoryStream ms = new MemoryStream(buffer); switch (Ext) { case ".dds": case ".tga": case ".jpg": case ".gif": case ".png": case ".bmp": if (handle.IsAllocated) { handle.Free(); } string Info = ""; switch (Ext) { case ".dds": case ".tga": Info = "DDS (Direct Draw Surfice)"; break; case ".jpg": Info = "JPEG"; break; case ".gif": Info = "GIF"; break; case ".bmp": Info = "Bitmap"; break; case ".png": Info = "PNG (Portable Network Graphic)"; break; } if (Ext == ".tga" || Ext == ".dds") { PictureView.Image = DDS2Bitmap(ms); } else { PictureView.Image = Image.FromStream(ms); } PictureView.Update(); Status.Text = String.Format("{0} Image file. ({1} x {2})", Info, PictureView.Width, PictureView.Height); PictureView.SizeMode = PictureBoxSizeMode.AutoSize; PicturePanel.AutoScroll = true; PicturePanel.Update(); PicturePanel.Show(); break; case ".xml": case ".html": case ".txt": case ".trn": string text = Encoding.Unicode.GetString(buffer); TextView.Clear(); TextView.Text = text; TextView.Update(); TextView.Show(); Status.Text = String.Format("Ascii file."); break; case ".wav": case ".mp3": pPlay.Show(); // http://msdn.microsoft.com/en-us/library/ms143770%28v=VS.100%29.aspx this.wave = new WavePlayer(buffer); this.wave.Play(); Status.Text = "Sound file."; break; default: if (InternalName == "vf.dat") { TextView.Clear(); TextView.Text = Encoding.ASCII.GetString(buffer); TextView.Update(); TextView.Show(); Status.Text = "Version infomation."; } else { DynamicByteProvider d = new DynamicByteProvider(buffer); hexBox.ByteProvider = d; Status.Text = "Unknown file."; } break; } ms.Dispose(); } this.Update(); }
public void CloseApplication(string button) { PictureView.GetButtonById(FileUtil.DataController.ReadParam(button)).Click(); }
/// <summary> /// Pass params to build the chart on start up, set null (is default) for nothing display /// </summary> /// <param name="sensor"></param> /// <param name="group"></param> /// <param name="pictureView"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="chartName"></param> /// <param name="xLabel"></param> /// <param name="yLabel"></param> /// <param name="showCalcValue"></param> public ChartViewForm(Sensor sensor = null, Group group = null, PictureView pictureView = null, DateTime?startDate = null, DateTime?endDate = null, string chartName = "Chart View", string xLabel = "Value", string yLabel = "Datetime", bool showCalcValue = true) { // set value to private field _sensor = sensor; _group = group; // ... // continue here InitializeComponent(); GraphPane myPane; LineItem mycurve; Random randomGen = new Random(); myPane = zedChartMain.GraphPane; myPane.XAxis.Type = AxisType.Date; myPane.XAxis.Scale.Format = "HH:mm:ss\ndd-MM-yyyy"; myPane.Title.Text = chartName; myPane.XAxis.Title.Text = xLabel; myPane.YAxis.Title.Text = yLabel; myPane.XAxis.MajorGrid.IsVisible = true; myPane.YAxis.MajorGrid.IsVisible = true; if (sensor != null) { List <SensorValue> listvalue = entityConntext.SensorValues.Where(ent => ent.SensorID == sensor.SensorID).ToList(); DataSourcePointList dsp = new DataSourcePointList(); dsp.DataSource = listvalue; if (!showCalcValue) { dsp.YDataMember = "RawValue"; } if (showCalcValue) { dsp.YDataMember = "CalcValue"; } dsp.XDataMember = "MeaTime"; mycurve = myPane.AddCurve(sensor.Name, dsp, Color.FromArgb(randomGen.Next(255), randomGen.Next(255), randomGen.Next(255))); mycurve.Line.Width = 1; } if (group != null) { List <Sensor> sensorsInGroup = group.Sensors.ToList(); for (int i = 0; i < sensorsInGroup.Count; i++) { int idsen = Convert.ToInt16(sensorsInGroup[i].SensorID); List <SensorValue> listvalue = entityConntext.SensorValues.Where(ent => ent.SensorID == idsen).ToList(); DataSourcePointList dsp = new DataSourcePointList(); dsp.DataSource = listvalue; if (!showCalcValue) { dsp.YDataMember = "RawValue"; } if (showCalcValue) { dsp.YDataMember = "CalcValue"; } dsp.XDataMember = "MeaTime"; mycurve = myPane.AddCurve(sensorsInGroup[i].Name, dsp, Color.FromArgb(randomGen.Next(255), randomGen.Next(255), randomGen.Next(255))); mycurve.Line.Width = 1; } } //lenh hien thi chart zedChartMain.IsShowPointValues = true; zedChartMain.AxisChange(); zedChartMain.Invalidate(); zedChartMain.Refresh(); }
private void img_Picture_Click(object sender, EventArgs e) { if (SelectedTenant.Image != null) { PictureView picView = new PictureView((Bitmap)img_Picture.Image) { obj = SelectedTenant, creatingForm = this }; picView.Show(); } else { if (openFileDialog1.ShowDialog() == DialogResult.OK) { using (MemoryStream fStream = new MemoryStream()) { openFileDialog1.OpenFile().CopyTo(fStream); SelectedTenant.ImageData = fStream.GetBuffer(); } img_Picture.Image = SelectedTenant.Image; try { creatingForm.LoadTenantPage(); } catch (Exception exception) { MessageBox.Show(exception.Message); } } } }
public List <int> GetParentPictureIDs(PictureView pictureView) { var parentIDs = new List <int>(); return(parentIDs); }
public ChangeImageCommand(PictureView form1, ImageSettings oldValue, ImageSettings newValue) { this.oldValue = oldValue; this.newValue = newValue; this.pictureView = form1; }
public void OpenPictureViewer(string fileName,IList<string> PicList) { PictureView view = new PictureView(); view.DataContext = new PictureViewModel(fileName,PicList); view.ShowActivated=false; view.Show(); }