Esempio n. 1
0
        public static LoadBase Create(LoadOptions info)
        {
            LoadBase load;

            switch (info.LoadType)
            {
            case LoadOptions.ELoadType.GCode:
                load = new LoadGCode();
                break;

            case LoadOptions.ELoadType.Hpgl:
                load = new LoadHpgl();
                break;

            case LoadOptions.ELoadType.Image:
                load = new LoadImage();
                break;

            case LoadOptions.ELoadType.ImageHole:
                load = new LoadImageHole();
                break;

            default: return(null);
            }

            load.LoadOptions = info;

            return(load);
        }
Esempio n. 2
0
		static public LoadBase Create(LoadOptions info)
		{
			LoadBase load = null;
			switch (info.LoadType)
			{
				case LoadOptions.ELoadType.GCode: load = new LoadGCode(); break;
				case LoadOptions.ELoadType.HPGL: load = new LoadHPGL(); break;
				case LoadOptions.ELoadType.Image: load = new LoadImage(); break;
				case LoadOptions.ELoadType.ImageHole: load = new LoadImageHole(); break;
				default: return null;
			}
			load.LoadOptions = info;

			return load;
		}
Esempio n. 3
0
		private async Task LoadAzureAsync(LoadOptions info)
		{
			using (var client = CreateHttpClient())
			{
				info.FileContent = File.ReadAllBytes(info.FileName);

				HttpResponseMessage response = await client.PostAsJsonAsync(api, info);
				string[] gcode = await response.Content.ReadAsAsync<string[]>();

				if (response.IsSuccessStatusCode)
				{
					var load = new LoadGCode();
					load.Load(gcode);
					Commands.Clear();
					Commands.AddRange(load.Commands);
					if (!string.IsNullOrEmpty(info.GCodeWriteToFileName))
					{
						SaveGCode(info.GCodeWriteToFileName);
					}
				}
			}
		}