From 3a4c17f148d84bfbb869513ecbc9d2c5ebb7f60d Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Sun, 26 Jul 2015 14:50:05 +0200 Subject: [PATCH] Add ribbon, AboutViewModel and AboutView. --- gimp/f.xcf | Bin 0 -> 1918 bytes gimp/i.xcf | Bin 0 -> 1836 bytes zaaReloaded2/Icons/f.png | Bin 0 -> 617 bytes zaaReloaded2/Icons/i.png | Bin 0 -> 482 bytes zaaReloaded2/Properties/Settings.Designer.cs | 60 +++++++++ zaaReloaded2/Properties/Settings.settings | 18 +++ zaaReloaded2/Ribbon.cs | 134 +++++++++++++++++++ zaaReloaded2/Ribbon.xml | 36 +++++ zaaReloaded2/Style.xaml | 55 ++++++++ zaaReloaded2/ThisAddIn.cs | 32 +++++ zaaReloaded2/Updater/Version.cs | 44 ++++++ zaaReloaded2/VERSION | 1 + zaaReloaded2/ViewModels/AboutViewModel.cs | 116 ++++++++++++++++ zaaReloaded2/Views/AboutView.xaml | 43 ++++++ zaaReloaded2/Views/AboutView.xaml.cs | 32 +++++ zaaReloaded2/app.config | 32 +++++ zaaReloaded2/zaaReloaded2.csproj | 33 ++++- 17 files changed, 635 insertions(+), 1 deletion(-) create mode 100644 gimp/f.xcf create mode 100644 gimp/i.xcf create mode 100644 zaaReloaded2/Icons/f.png create mode 100644 zaaReloaded2/Icons/i.png create mode 100755 zaaReloaded2/Ribbon.cs create mode 100755 zaaReloaded2/Ribbon.xml create mode 100755 zaaReloaded2/Style.xaml create mode 100755 zaaReloaded2/Updater/Version.cs create mode 100755 zaaReloaded2/VERSION create mode 100755 zaaReloaded2/ViewModels/AboutViewModel.cs create mode 100755 zaaReloaded2/Views/AboutView.xaml create mode 100755 zaaReloaded2/Views/AboutView.xaml.cs diff --git a/gimp/f.xcf b/gimp/f.xcf new file mode 100644 index 0000000000000000000000000000000000000000..a5cf985bf07f38917a4de36d527e9eb6837ce921 GIT binary patch literal 1918 zcmeHIy>HYo6!-PM+G|gIl@6$bbzQDQP)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%a;sX_%MP->BUx7@>ls_vzJ;EvTGlH#T<(z_&>r8hRnaFgUy-cC z4kKA%yaBy5+Y8~o3F0U<9!CG{L87zBHa$q~Hq)$ literal 0 HcmV?d00001 diff --git a/zaaReloaded2/Icons/f.png b/zaaReloaded2/Icons/f.png new file mode 100644 index 0000000000000000000000000000000000000000..e13cd9951ed23b365d3225892a739ba261d5bc2a GIT binary patch literal 617 zcmV-v0+#)WP)NaE1X1Fu@r9|Nk2^FfcGM(oBW_|Nq7~RiFbFWRA;K!D}z{rf)-Sz2Dl>IVP+|BW{?GM**L z4R8f+PoC()OcAiK;3C?a1QihN1ezG&|Np-+hnyTM$zE`K@E!D`(wwxQQZLs^XJRTCnSh5FfcHDfByW}+k*!`{`vg*FB1m`6T7G=3%i5_+wTt_ z{t~jBYzK(g+w;NLJEf#9Gtwg$;A(E*0@#`%RLh32qMDc*XEYlQpK?ICxLAaRkB^yw zfq{XQpC7JIy|GaooB9VcX1x9R{P~~ZnF~e}AvFO2WW2!FOZ^ws00000NkvXXu0mjf DmX-`G literal 0 HcmV?d00001 diff --git a/zaaReloaded2/Icons/i.png b/zaaReloaded2/Icons/i.png new file mode 100644 index 0000000000000000000000000000000000000000..c3f1caf3574a6da91f3a6931243d998dd3def0d6 GIT binary patch literal 482 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE#=yYHQtOojvn6@E zy8vkhh7Cqa9G`(SXMsm#F#`kN5fEmas?8@26l5>)^mS#w&o0HSuaqhH^CnP8q{KC% z#5q4VH#M(>!6h*-Gc`xSyC|`=c&D3Y570t;PZ!6Kh{MS#2{#Jb7NO8o!-TY51^ z!iok)w>fDK#DDz1e_tYvyG^p9*Wp@cD5LV@W1Cs#dTwG;V`FMCVFjtazx(+j-%0u% z+m+Pa1AqLluTOS$&EtD=V3CcC1|Qp(9gBByM-+IPn62tIHZU-_ay9eBo&Ep6woke= zZ*|Jf2O#w|YzBq_92xT5&G%Wim_E2?E1v75S@?iiFgs|T@o@(;%g8vMc+bY`4ZPCx z>MMSI`K=!jx8MXf$nwX<2NnF;Q{0u;9XWhx)5kma_w)R3k4#&1gPZwXv*LROF)tI4 z`_`^Fan^Cg0f{S$1`j$XEYWb#Up|p>-!*1mXNItxiLVs$2U$;m1%m7jdxe=VaVd9BzP7=HflES%%DtPmK~ N44$rjF6*2UngF + + zaaReloaded2 + + + 2015 + + + Daniel Kraus + + + http://zaa.nephrowiki.de + + + http://zaa.nephrowiki.de/updates + + + versioninfo.txt + \ No newline at end of file diff --git a/zaaReloaded2/Ribbon.cs b/zaaReloaded2/Ribbon.cs new file mode 100755 index 0000000..b403a80 --- /dev/null +++ b/zaaReloaded2/Ribbon.cs @@ -0,0 +1,134 @@ +/* Ribbon.cs + * part of zaaReloaded2 + * + * Copyright 2015 Daniel Kraus + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows; +using System.Drawing; +using System.Windows.Resources; +using Office = Microsoft.Office.Core; + +// TODO: Follow these steps to enable the Ribbon (XML) item: + +// 1: Copy the following code block into the ThisAddin, ThisWorkbook, or ThisDocument class. + +// protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject() +// { +// return new Ribbon(); +// } + +// 2. Create callback methods in the "Ribbon Callbacks" region of this class to handle user +// actions, such as clicking a button. Note: if you have exported this Ribbon from the Ribbon designer, +// move your code from the event handlers to the callback methods and modify the code to work with the +// Ribbon extensibility (RibbonX) programming model. + +// 3. Assign attributes to the control tags in the Ribbon XML file to identify the appropriate callback methods in your code. + +// For more information, see the Ribbon XML documentation in the Visual Studio Tools for Office Help. + + +namespace zaaReloaded2 +{ + [ComVisible(true)] + public class Ribbon : Office.IRibbonExtensibility + { + private Office.IRibbonUI ribbon; + + public Ribbon() + { + } + + #region IRibbonExtensibility Members + + public string GetCustomUI(string ribbonID) + { + return GetResourceText("zaaReloaded2.Ribbon.xml"); + } + + #endregion + + #region Ribbon Callbacks + //Create callback methods here. For more information about adding callback methods, visit http://go.microsoft.com/fwlink/?LinkID=271226 + + public void Ribbon_Load(Office.IRibbonUI ribbonUI) + { + this.ribbon = ribbonUI; + } + + public void Ribbon_Click(Office.IRibbonControl control) + { + switch (control.Id) + { + case "zrlAbout": + ViewModels.AboutViewModel vm = new ViewModels.AboutViewModel(); + vm.InjectInto().ShowDialog(); + break; + default: + throw new InvalidOperationException("No operation defined for " + control.Id); + } + } + + /// + /// Returns an Image object for the ribbon. + /// + /// + /// The image file is expected to be a WPF resource file, not an embedded resource. + /// To be consistent accross the application which uses WPF resources for its WPF + /// windows, all images are to be built as resources rather than embedded resources. + /// + /// The file name (without path) of the image. + /// Image object + public object Ribbon_LoadImage(string imageId) + { + string initPackScheme = System.IO.Packaging.PackUriHelper.UriSchemePack; + StreamResourceInfo sri = Application.GetResourceStream( + new Uri(@"pack://application:,,,/zaaReloaded2;component/Icons/" + imageId)); + return Image.FromStream(sri.Stream); + } + + #endregion + + #region Helpers + + private static string GetResourceText(string resourceName) + { + Assembly asm = Assembly.GetExecutingAssembly(); + string[] resourceNames = asm.GetManifestResourceNames(); + for (int i = 0; i < resourceNames.Length; ++i) + { + if (string.Compare(resourceName, resourceNames[i], StringComparison.OrdinalIgnoreCase) == 0) + { + using (StreamReader resourceReader = new StreamReader(asm.GetManifestResourceStream(resourceNames[i]))) + { + if (resourceReader != null) + { + return resourceReader.ReadToEnd(); + } + } + } + } + return null; + } + + #endregion + } +} diff --git a/zaaReloaded2/Ribbon.xml b/zaaReloaded2/Ribbon.xml new file mode 100755 index 0000000..cd12b15 --- /dev/null +++ b/zaaReloaded2/Ribbon.xml @@ -0,0 +1,36 @@ + + + + + + + + +