I found an application in C# to print with Dymo 550..I use Dymo.sdk..now I have an error but I don't know the cause:
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. WPFSDKSample C:\Users\VDS\Desktop\cartella\DCD-SDK-Sample-master\WPF\WPFSDKSample\ViewModels\MainViewModel.cs 22 Active
I write my code, I solved problem above adduing library but I have a doubt:
using DymoSDK.Implementations;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace WPFSDKSample.ViewModels
{
public class MainViewModel : BaseViewModel
{
DymoSDK.Interfaces.IDymoLabel dymoSDKLabel;
public MainViewModel()
{
DymoSDK.App.Init();
dymoSDKLabel = DymoLabel.Instance;
var Printers = DymoPrinter.Instance.GetPrinters();
var TwinTurboRolls = new List<string>() { "Auto", "Left", "Right" };
}
private void OpenFileAction()
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "DYMO files |*.label;*.dymo|All files|*.*";
if (openFileDialog.ShowDialog() == true)
{
var FileName = openFileDialog.FileName;
dymoSDKLabel.LoadLabelFromFilePath(FileName);
dymoSDKLabel.GetPreviewLabel();
var ImageSourcePreview = LoadImage(dymoSDKLabel.Preview);
var LabelObjects = dymoSDKLabel.GetLabelObjects().ToList();
}
}
private void PrintLabelAction()
{
int copies = 1;
if (SelectedPrinter != null)
{
if (SelectedPrinter.Name.Contains("Twin Turbo"))
{
int rollSel = SelectedRoll == "Auto" ? 0 : SelectedRoll == "Left" ? 1 : 2;
DymoPrinter.Instance.PrintLabel(dymoSDKLabel, SelectedPrinter.Name, copies, rollSelected: rollSel);
}
else
DymoPrinter.Instance.PrintLabel(dymoSDKLabel, SelectedPrinter.Name, copies);
var counterObjs = dymoSDKLabel.GetLabelObjects().Where(w => w.Type == DymoSDK.Interfaces.TypeObject.CounterObject).ToList();
if (counterObjs.Count > 0)
{
foreach (var obj in counterObjs)
dymoSDKLabel.UpdateLabelObject(obj, copies.ToString());
UpdatePreviewAction();
}
}
}
I don't know c#, I don't understand if Selected Printer is a var o an objectof a library..because I have errore where is written SelectedPrinter
What I have tried:
I noticed that my program have problem to see in reference Microsoft.Office.Interop.InfoPath.SemiTrust