Table Of Contens 1. Class Example |
1. Example
class ProcessingSVG
{
public List SVGlist = new List();
// SVG를 처리하는 Class
public class SvgClass
{
private SkiaSharp.Extended.Svg.SKSvg svg;
// Get file .svg to folder Images
// Form Embeded Resoure
Stream GetImageStream(string svgName, Type PageType)
{
TypeInfo PageInfo = PageType.GetTypeInfo();
Assembly assembly = PageInfo.Assembly;
var abc = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.Images.{svgName}");
return abc;
}
// return picture of the SVG
public SKPicture GetPicture()
{
return svg.Picture;
}
public void LoadSvg(string svgName, Type PageType)
{
// create a new SVG object
svg = new SkiaSharp.Extended.Svg.SKSvg();
// load the SVG document from a stream
using (var stream = GetImageStream(svgName, PageType))
svg.Load(stream);
}
}
}
// Save SVG File
ProcessingSVG XX_SVG = new ProcessingSVG();
const int NumberOfSVG = 10;
void LoadSVGimage()
{
// Data Exist
if (XX_SVG.SVGlist != null) XX_SVG.SVGlist.Clear();
for(int i=0; i< NumberOfSVG; i++)
{
var oneSVG = new ProcessingSVG.SvgClass();
oneSVG.LoadSvg("test"+i.ToString()+".svg", typeof(MainPage));
XX_SVG.SVGlist.Add(oneSVG);
}
}
// Draw SVG Picture
canvasXX.Save();
canvasXX.Scale(0.1f);
canvasXX.DrawPicture(XX_SVG.SVGlist[7].GetPicture(), 0,0);
canvasXX.Restore();
2. Reference
https://stackoverflow.com/questions/58259473/how-to-load-file-svg-with-skiasharp-on-xamarin-forms
'컴퓨터 이야기 > xamarin' 카테고리의 다른 글
[xamarin]Android icon folder (0) | 2020.06.03 |
---|---|
[xamarin]embedded resource로 mp3 등록 하여 소리내기 (0) | 2020.06.02 |
[xamarin] Screen Tap Event Handler (0) | 2020.05.14 |
[svg] SVG 파일을 만들어 주는 곳 (0) | 2020.05.14 |
[xamarin] SKShader Class (0) | 2020.05.09 |
C# Program을 Real Time 성능에 가깝게
C# Program을 Real Time 성능에 가깝게
문제점
PLC를 사용하다가 보면 REAL-TIME 응답이 필요한 경우가 많이있습니다.
PLC의 경우 I/O 통신에서 극한적인 경우 1ms 정도, 보통 10~20ms 정도에 응답이 됩니다.
그러나 PC의 경우 하드디스크 억세스, 통신 연결 시도, 통신 실패, 가베지 컬렉션등이 발생하면 심한 경우 몇 초 이상의 딜레이, 지터 (JITTER)가 발생합니다.
PC를 PLC에 연결하여 사용하는 경우 PC는 OS 자체가 REAL-TIME이 아니기 때문에 속도를 요하는 통신 프로그램에서는 더욱 힘듭니다.
근본적으로 PC에 WINDOW는 REAL-TIME OS가 아니기 때문입니다.
따라서 REAL-TIME O/S하에서 PROCESS가 동작해야 해결될 문제입니다.
그래도 아래와 같은 코드를 넣으면 최대한 REAL-TIME에 가깝도록 되기는 합니다.
간단히 실험해 본 결과 10ms THREAD에서 시스템 부하를 조금씩 늘려 본 결과 10ms ~ 12ms 정도로 비교적 양호한 결과를 얻었습니다.
방법
아래와 같이 Program의 Priority를 올려주고 Thread의 Priority를 올려주는 방법을 사용하여 꽤 높은 Real-Time응답을 얻을 수 있었습니다.
/////////////////////////////////////////////// /////////////////////////////////////////////////////////// |
참조링크
'컴퓨터 이야기 > c#' 카테고리의 다른 글
visual studio 빌드 후 이벤트 (0) | 2018.11.29 |
---|---|
Text File Save Dialog (0) | 2018.06.09 |
File Name을 선택해서 Text 파일 읽기 (0) | 2018.06.09 |
How to move and resize a form without a border? (0) | 2018.06.09 |
Form을 Drag해서 이동 (0) | 2018.06.09 |
visual studio 빌드 후 이벤트
IF NOT EXIST c:\sssCom MD c:\sssCom |
Visual Studio에서 Build후 이벤트에 Command Line 명령어를 넣어 놓으면 방금 빌드한 파일을 원하는 폴더로 Copy 할 수 있다.
빌드 후 편집을 누르고 매크로를 누르면 $(TargetPath)등으로 프로젝트 폴더, 파일등의 정보를 삽입 할 수 있다.
'컴퓨터 이야기 > c#' 카테고리의 다른 글
C# Program을 Real Time 성능에 가깝게 (0) | 2018.12.11 |
---|---|
Text File Save Dialog (0) | 2018.06.09 |
File Name을 선택해서 Text 파일 읽기 (0) | 2018.06.09 |
How to move and resize a form without a border? (0) | 2018.06.09 |
Form을 Drag해서 이동 (0) | 2018.06.09 |
File Name을 선택해서 Text 파일 읽기
File Name을 선택해서 Text 파일 읽기
OpenFileDialog dlg = new OpenFileDialog(); |
'컴퓨터 이야기 > c#' 카테고리의 다른 글
visual studio 빌드 후 이벤트 (0) | 2018.11.29 |
---|---|
Text File Save Dialog (0) | 2018.06.09 |
How to move and resize a form without a border? (0) | 2018.06.09 |
Form을 Drag해서 이동 (0) | 2018.06.09 |
Program 2번 실행 방지 (0) | 2018.06.06 |
How to move and resize a form without a border?
|
'컴퓨터 이야기 > c#' 카테고리의 다른 글
Text File Save Dialog (0) | 2018.06.09 |
---|---|
File Name을 선택해서 Text 파일 읽기 (0) | 2018.06.09 |
Form을 Drag해서 이동 (0) | 2018.06.09 |
Program 2번 실행 방지 (0) | 2018.06.06 |
Tray로 Form을 Icon화 하기 (0) | 2018.06.06 |
Form을 Drag해서 이동
/// <summary> /// Form을 Drag 해서 이동 /// </summary> public const int WM_NCLBUTTONDOWN = 0xA1; public const int HT_CAPTION = 0x2; [DllImportAttribute("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); [DllImportAttribute("user32.dll")] public static extern bool ReleaseCapture(); // Main Form을 마우스로 잡고 이동 private void FormMain_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { ReleaseCapture(); SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); } } // menu Strip 부분을 마우스로 잡고 이동 private void menuStrip1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { ReleaseCapture(); SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); } } |
'컴퓨터 이야기 > c#' 카테고리의 다른 글
Text File Save Dialog (0) | 2018.06.09 |
---|---|
File Name을 선택해서 Text 파일 읽기 (0) | 2018.06.09 |
How to move and resize a form without a border? (0) | 2018.06.09 |
Program 2번 실행 방지 (0) | 2018.06.06 |
Tray로 Form을 Icon화 하기 (0) | 2018.06.06 |