Exemple #1
0
        void AttachAddin(string ext_node_id, Note note, NoteAddin addin)
        {
            if (ext_node_id == null || note == null || addin == null)
            {
                throw new ArgumentNullException("Cannot pass in a null parameter to AttachAddin");
            }

            // Loading the addin to the note
            try {
                addin.Initialize(note);
            } catch (Exception e) {
                Logger.Warn("Error initializing addin: {0}: {1}",
                            addin.GetType().ToString(), e.Message);
                // TODO: Would be nice to figure out how to just disable
                // the addin altogether if it's failing to initialize so
                // it doesn't keep causing problems.
                return;
            }

            NoteAddinInfo        info = new NoteAddinInfo(ext_node_id, note, addin);
            List <NoteAddinInfo> note_addin_list;
            List <NoteAddinInfo> ext_node_addin_list;

            if (note_addins.ContainsKey(note))
            {
                note_addin_list = note_addins [note];
            }
            else
            {
                note_addin_list    = new List <NoteAddinInfo> ();
                note_addins [note] = note_addin_list;
            }

            if (note_addin_infos.ContainsKey(ext_node_id))
            {
                ext_node_addin_list = note_addin_infos [ext_node_id];
            }
            else
            {
                ext_node_addin_list            = new List <NoteAddinInfo> ();
                note_addin_infos [ext_node_id] = ext_node_addin_list;
            }

            note_addin_list.Add(info);
            ext_node_addin_list.Add(info);
        }
Exemple #2
0
		void AttachAddin (string ext_node_id, Note note, NoteAddin addin)
		{
			if (ext_node_id == null || note == null || addin == null)
				throw new ArgumentNullException ("Cannot pass in a null parameter to AttachAddin");

			// Loading the addin to the note
			try {
				addin.Initialize (note);
			} catch (Exception e) {
				Logger.Warn ("Error initializing addin: {0}: {1}",
				             addin.GetType ().ToString (), e.Message);
				// TODO: Would be nice to figure out how to just disable
				// the addin altogether if it's failing to initialize so
				// it doesn't keep causing problems.
				return;
			}

			NoteAddinInfo info = new NoteAddinInfo (ext_node_id, note, addin);
			List<NoteAddinInfo> note_addin_list;
			List<NoteAddinInfo> ext_node_addin_list;

			if (note_addins.ContainsKey (note))
				note_addin_list = note_addins [note];
			else {
				note_addin_list = new List<NoteAddinInfo> ();
				note_addins [note] = note_addin_list;
			}

			if (note_addin_infos.ContainsKey (ext_node_id))
				ext_node_addin_list = note_addin_infos [ext_node_id];
			else {
				ext_node_addin_list = new List<NoteAddinInfo> ();
				note_addin_infos [ext_node_id] = ext_node_addin_list;
			}

			note_addin_list.Add (info);
			ext_node_addin_list.Add (info);
		}