Click here to Skip to main content
15,867,957 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
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:

C#
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" };
        }
        /// <summary>
        /// Open a Dymo label file and load the content in the instance of the class
        /// Get the preview image of the label
        /// Get the list of object names
        /// </summary>
        private void OpenFileAction()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "DYMO files |*.label;*.dymo|All files|*.*";

            if (openFileDialog.ShowDialog() == true)
            {
                var FileName = openFileDialog.FileName;
               // DymoSDK.App.Init();
                //Load label from file path
                dymoSDKLabel.LoadLabelFromFilePath(FileName);
                //Get image preview of the label
                dymoSDKLabel.GetPreviewLabel();
                //Load image preview in the control 
                var ImageSourcePreview = LoadImage(dymoSDKLabel.Preview);
                //Get object names list
                var LabelObjects = dymoSDKLabel.GetLabelObjects().ToList();
            }
        }
        /// <summary>
        /// Print the current loaded label using the selected printer name
        /// </summary>
        private void PrintLabelAction()
        {
            int copies = 1;
           

            if (SelectedPrinter != null)
            {
                //Send to print
                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);

                //If the label contains counter objects
                //Update counter object and preview to show the incresead value of the counter
                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();
                }
            }
        }
        /// <summary>
        /// Update the object value using the object name selected
        /// </summary>



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
Posted
Updated 8-Feb-23 2:16am
v5
Comments
Graeme_Grant 8-Feb-23 3:09am    
the message is clear: 'Object' is defined in an assembly that is not referenced.
Member 14594285 8-Feb-23 5:36am    
I solved that error, but I have problems with variables;
Andre Oosthuizen 8-Feb-23 3:50am    
It even tell you which reference and version to use - You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Member 14594285 8-Feb-23 5:37am    
I solved that error but now I have problems with variables
Dave Kreskowiak 8-Feb-23 8:36am    
Nobody has any idea what you mean by "now I have a problem with variables"? What variables? What error messages?

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900